根代码示例
import { createScope, animate } from 'animejs';
createScope({ root: '.row:nth-child(2)' })
.add(() => {
animate('.square', {
x: '17rem',
loop: true,
alternate: true
});
});
<div class="medium row">
<div class="square"></div>
<div class="padded label">outside scope</div>
</div>
<div class="medium row">
<div class="square"></div>
<div class="padded label">inside scope</div>
</div>
<div class="medium row">
<div class="square"></div>
<div class="padded label">outside scope</div>
</div>