sTAGGED TETX

import { stagger, zoom, spin } from '@velo/wix-animation-helpers';

$w.onReady(function () {

// staggered text

const textToWrite = 'Mr and Mrs Dursley, of number four, Privet Drive, were proud to say that they were perfectly normal, thank you very much.';

$w('#selfWrittenText').text = '';

let previousCharWasBlank = false;

stagger(textToWrite.split(''), char => {

if (char === ' ') {

previousCharWasBlank = true;

} else {

if (previousCharWasBlank) {

// update text with the new character while adding a blank before it

$w('#selfWrittenText').text += ' ' + char;

previousCharWasBlank = false;

} else {

// update text with the new character

$w('#selfWrittenText').text += char;

}

}

}, 200, $w('#selfWrittenText'));

// staggered spin

const box2 = $w('#box2').children;

stagger(box2, comp => spin(comp, { duration: 2000, direction: 'cw' }), 3000);

// staggered zoom

const box1 = $w('#box1').children;

setInterval(function () { stagger(box1, zoom, 400); }, 3000);

});