revert()
Reverts the split target html back to its original state, removing debug styles and reverting all animations added with split.addEffect()
in the process.
Returns
TextSplitter
revert() code example
import { animate, stagger, text } from 'animejs';
const [ $button ] = utils.$('button');
const [ $p ] = utils.$('p');
const split = text.split('p', {
words: { wrap: 'clip' },
debug: true,
});
split.addEffect((self) => animate(self.words, {
y: ['100%', '0%'],
duration: 1250,
ease: 'out(3)',
delay: stagger(100),
loop: true,
alternate: true,
}));
const revertSplit = () => {
split.revert();
$button.setAttribute('disabled', 'true');
}
$button.addEventListener('click', revertSplit);
<div class="large centered row">
<p class="text-xl">Split text by words.<br>単語ごとに分割します。</p>
</div>
<div class="medium row">
<fieldset class="controls">
<button>Revert</button>
</fieldset>
</div>