https://animation-animjs-4.glitch.me/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>hover over me</h1>
<section>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</section>
<script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha512-z4OUqw38qNLpn1libAN9BsoDx6nbNFio5lA6CuTp9NlK83b89hgyCVq+N5FdBJptINztxn1Z3SaKSKUS5UP60Q==" crossorigin="anonymous"></script>
<script>
let tl = anime.timeline({
easing: 'easeOutExpo',
duration: 750
})
tl.add ({
targets: 'section div',
width: '100%',
backgroundColor: 'rgb(197, 197, 255)',
delay: anime.stagger(100)
})
tl.add ({
targets: 'section div',
width: '90%',
backgroundColor: 'rgb(235, 235, 255)',
// delay: anime.stagger(100)
})
tl.add ({
targets: 'h1',
width: '20%',
opacity: 1,
duration: 4000,
// backgroundColor: 'rgb(235, 235, 255)',
// delay: anime.stagger(100)
}, '-=1600') //the speed of the text showing up can be controled by controling this number
let rotate = anime({
targets: 'section',
scaleY: '2',
scaleX: '2',
translateX: '40%',
rotate: '45deg',
duration: 5000,
autoplay: false
})
document.querySelector('h1').addEventListener('mouseover', () => {
rotate.play();
})
// let grids = document.querySelectorAll('div');
// let num = 0;
// const delay = time => new Promise(resolve => setTimeout(resolve, time));
// grids.forEach(grid => {
// delay(0).then(() => {
// setTimeout(() => {
// grid.style.backgroundColor = 'lightblue';
// }, num += 100);
// });
// delay(500).then(() => {
// setTimeout(() => {
// grid.style.backgroundColor = 'rgb(228, 242, 255)';
// grid.style.width = '90%'
// }, num += 100);
// })
// })
</script>
</body>
</html>
Comments