Best way to do stepped (non interpolated) animation?

Currently I’m using setInterval to make object changes at fixed intervals e.g. like say toggling a light on and off, but I was wondering if the Animation classes can somehow be used to do the same thing, just without any interpolation between key frames?

Using setInterval I strangely ended up with some timing glitches, like other processes were interferring and causing the intervals not to be consistent. I see in the Sprite code that a delta time check is being used in a render method, not setInterval. Is this the best approach or can the Animation classes be used without interpolation?

This may prove useful for you to look at Sequence Animations - Babylon.js Documentation

In particular the sweep_keys for the door. Frames 0 to 3*frame rate all have value 0 hence no interpolation. Careful use of constant values over set key frames can give you non interpolated intervals

1 Like

Thanks @JohnK