Hi @EpicTriffid ,
First, let's assume timer duration is set to 500ms, and target height of rectangle is 500 to keep it simple. We also use a value of true for menuDirection when it's opening, false when it's closing. By default it starts off false.
Button Onselect:
UpdateContext({animatonStart: true, menuDirection: !menuDirection})
Timer;
OnTimerEnd: UpdateContext({animationStart: false})
Start: animationStart
Duration: 500
Rectangle Height:
If(menuDirection, Timer.Value, 500-Timer.Value)
So here's where the stutter comes in. If you're using the Timer.Value as the derivitive value for your menu height, then the reason you get the stutter is the end state of the Timer and how it resets. Certainly, this was the case for me, so I'm guessing it's the same for you.
The timer always runs in one direction - from 0 to 500.
At the end of its cycle, it's sitting at 500. When the cycle starts again, even though it resets - it resets from 500, meaning your rectangle starts at 500, then jumps to 0 as the timer restarts - hence the stutter.
To avoid this, we need to do two things;
- Reset the timer automatically after a cycle.
- Record the state of the rectangle (open or closed) and specify the open or closed height, using that as our base instead of the Timer.Value for the height
Timer;
OnTimerEnd:
UpdateContext({runAnimation: false});
Reset(Timer);
If(menuDirection,
UpdateContext({menuState: 500}),
UpdateContext({menuState: 0}))
Start: animationStart
Duration: 500
Rectangle Height:
If(menuDirection, menuState+Timer.Value, menuState-Timer.Value)
This cleared it up for me 🙂
Hope this helps,
RT