how can i create a css animation in javascript?

You can use javascript with transition to achieve it

// start frame
const start = {
  opacity: 0

// end frame
const end = {
  opacity: 1

const element = document.querySelector('span');
Object.assign(, start); = 'all 5s linear';

requestAnimationFrame(() => {
  Object.assign(, end);
<span>Lorem Ipsum</span>

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top