How to use the Lemur open/close effect

I’m trying to do something like Effects and Animation · jMonkeyEngine-Contributions/Lemur Wiki · GitHub

This is my code:

    public static void showWidget(){
        widget.runEffect("show");
        timeShowed=System.currentTimeMillis()+2500;
    }
    
    @Override
    public void update(float tpf) {

        if (System.currentTimeMillis()>timeShowed){
            widget.runEffect("hide");
        }
        

So I basically call showWidget when I need the widget to be shown, with a timeout autohide. Problem is, it doesn’t work as I want it… it basically remain always in “show” position.

EDIT: I have to add that if I delete the timeShowed thing and just run the “show” or “hide” animation manually these works correctly.

1 Like

Your if block will continue to run the effect over and over and over I guess… constantly interrupting and restarting the previous one.

I suspect you only want to fire it once.

1 Like