interval = 2;
shakeDur = 0.5;
amp = 25;
freq = 30;
loopTime = time % interval;
if (loopTime < shakeDur) {
Math.sin(loopTime * freq) * amp * (1 - loopTime/shakeDur);
} else {
0;
}
Creates a periodic burst of high-frequency oscillation (shaking) followed by a moment of stillness. This simulates the physics of an object being struck or vibrated at specific intervals rather than moving continuously.
Contributed by:
Perfect for animating notification icons, alarm clocks, or holiday jingle bells that need to "ring" periodically to grab the viewer's attention.