Forum Discussion
RussLickteig
5 days agoCommunity Member
Center point is off when I use JavaScript for animation creation.
Hey everyone. If I use the typical animations SPIN to animate a circle the circle rotates perfectly centered as it should. If I use the new AI tool in SL to create a custom animation with javaScrip...
RussLickteig
5 days agoCommunity Member
/*
JS - Locked Centered Continuous Slow Rotation Animation for Oval 1
Animation Details:
- Oval 1 rotates 360 degrees in 5 seconds.
- Rotation is locked around its center.
- Animation repeats indefinitely.
*/
const oval = object('5nl2b3u6wAP'); // Oval 1 object ID
// --- Initial Setup ---
oval.style.opacity = 1; // Ensure the oval is visible
oval.style.transformOrigin = '50% 50%'; // Lock the rotation point to the absolute center
// --- Continuous Rotation Animation ---
oval.animate(
[
{ rotate: '0deg' }, // Start at 0 degrees
{ rotate: '360deg' } // Complete a full rotation
],
{
duration: 5000, // 5 seconds per rotation
iterations: Infinity, // Infinite repetitions
easing: 'linear' // Smooth, continuous rotation
}
);