Looping Wave

Generates a wave motion that loops seamlessly.

Code

amp = 50;
period = 2; // seconds for one wave cycle
cycleTime = (time % period) / period;
sinVal = Math.sin(cycleTime * Math.PI * 2);
[value[0], value[1] + sinVal * amp]
loopwave2Danimation

How to Use

Use on Position for a continuous up-and-down wave that restarts cleanly every period. Perfect for looping backgrounds or repeated elements.