Layout callbacks
Layout animations inherit all Timeline callbacks, allowing you to execute functions at specific points during playback like you would with a regular Timeline.
import { createLayout } from 'animejs';
createLayout(root, {
children: '.item',
duration: 350,
delay: 0,
ease: 'inOut(3.5)',
properties: ['boxShadow'],
enterFrom: { opacity: 0 },
leaveTo: { opacity: 0 },
swapAt: { opacity: 0 },
┌───────────────────────────┐
│ onBegin: () => {}, │
│ onUpdate: () => {}, ├─ Callbacks
│ onComplete: () => {}, │
}).then(() => {}); │
└───────────────────────────┘
The .then() method is also available on the Timeline returned by .update() or .animate().