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
Rotates just fine with this script from ChatGPT.
if (obj) {
const rotationSpeed = 360 / 10000; // 10 seconds per rotation
let lastTime = performance.now();
let rotation = 0;
// Capture Storyline’s original transform
const baseTransform = obj.style.transform || "";
function rotateGraphic(currentTime) {
const deltaTime = currentTime - lastTime;
lastTime = currentTime;
rotation += deltaTime * rotationSpeed;
obj.style.transform = `${baseTransform} rotate(${rotation}deg)`;
requestAnimationFrame(rotateGraphic);
}
requestAnimationFrame(rotateGraphic);
}