使用“ gsap”的动画代码为以下代码
$('polygon').each(function() {
var minY = -600;
var maxY = 0;
var minX = -600;
var maxX = 600;
var randomY = Math.floor(Math.random() * (maxY - minY + 1)) + minY;
var randomX = Math.floor(Math.random() * (maxX - minX + 1)) + minX;
var tl = new TimelineLite();
tl
.set(this, {
transformOrigin: "50% 50%",
position: "absolute",
x: randomX,
y: randomY,
rotation: randomX,
scale: 1
})
.to(this, 3, {
x: 0,
y: 0,
rotation: 0,
scale: 1
}, 0.5);
});
动画是在bootstrap 4滑块中制作的。动画仅在第一张幻灯片上起作用。如何在每次幻灯片更改时开始播放动画