方向和循环
优质
小牛编辑
126浏览
2023-12-01
direction(方向)
定义动画的方向。
Accepts | Infos |
'normal' | 正方向动画 |
'reverse' | 反方向动画 |
'alternate' | 往返 |
anime({
targets: '.dir-normal',
translateX: 250,
easing: 'easeInOutSine'
});
anime({
targets: '.dir-reverse',
translateX: 250,
direction: 'reverse',
easing: 'easeInOutSine'
});
anime({
targets: '.dir-alternate',
translateX: 250,
direction: 'alternate',
easing: 'easeInOutSine'
});
loop(循环)
定义动画的往复次数。
Accepts | Infos |
Number | 循环次数 |
true | 无限循环 |
anime({
targets: '.loop',
translateX: 270,
loop: 3,
easing: 'easeInOutSine'
});
anime({
targets: '.loop-infinity',
translateX: 270,
loop: true,
easing: 'easeInOutSine'
});
anime({
targets: '.loop-reverse',
translateX: 270,
loop: 3,
direction: 'reverse',
easing: 'easeInOutSine'
});
anime({
targets: '.loop-reverse-infinity',
translateX: 270,
direction: 'reverse',
loop: true,
easing: 'easeInOutSine'
});
anime({
targets: '.loop-alternate',
translateX: 270,
loop: 3,
direction: 'alternate',
easing: 'easeInOutSine'
});
anime({
targets: '.loop-alternate-infinity',
translateX: 270,
direction: 'alternate',
loop: true,
easing: 'easeInOutSine'
});
autoplay(自动播放)
定义动画是否应自动启动。
Accepts | Infos |
true | 开启自动播放 |
false | 关闭自动播放 |
anime({
targets: '.autoplay-true',
translateX: 250,
autoplay: true,
easing: 'easeInOutSine'
});
anime({
targets: '.autoplay-false',
translateX: 250,
autoplay: false,
easing: 'easeInOutSine'
});