JSFiddle - React, Tailwind, and code Playground
by jt3k
HTML
<div class="box">
<div>
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
</div>
</div>
CSS
body {
height: 200vh; /* Увеличиваем высоту страницы для прокрутки */
margin: 0;
display: flex;
justify-content: center;
align-items: center;
background: linear-gradient(to bottom, #f0f0f0, #ccc);
}
.box {
width: 100px;
height: 100px;
background-color: #3498db;
animation: scaleAnimation 1s linear both;
animation-timeline: view(); /* Привязываем анимацию к прокрутке */
}
@keyframes scaleAnimation {
0% {
transform: scale(1);
}
100% {
transform: scale(2);
}
}