autoplay
Defines the play mode of an animation.
The autoplay parameter has no effect when the animation is added to a timeline, and will be overridden to false.
Accepts
Boolean | onScroll()
- If set to
truethe animation plays automatically - If set to
falsethe animation has to be manually played - If set to
onScroll()the animation will starts when the scroll thresholds conditions are met
Default
true
To change the default value globally, update the engine.defaults object.
import { engine } from 'animejs';
engine.defaults.autoplay = false;
autoplay code example
animate('.autoplay-true', {
x: '17rem',
autoplay: true, // Default
});
animate('.autoplay-false', {
x: '17rem',
autoplay: false,
});
<div class="medium row">
<div class="circle autoplay-true"></div>
<div class="padded label">autoplay: true</div>
</div>
<div class="medium row">
<div class="circle autoplay-false"></div>
<div class="padded label">autoplay: false</div>
</div>