Get started with web-animations CDN

Apache-2.0 licensed

CSS, JS drive web-animations: visual effects, transitions, enhanced user experience.

Tags:
  • html
  • animation
  • web-animations

Stable version

Copied!

How to start using web-animations CDN


<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="styles.css">
  <script src="https://cdn.cdnhub.io/web-animations/2.3.2/web-animations.min.js"></script>
</head>
<body>
  <button id="animate">Animate</button>

  <script>
    const button = document.getElementById('animate');
    const keyframes = [
      { transform: 'translateX(0px)' },
      { transform: 'translateX(100px)' },
      { transform: 'translateX(0px)' }
    ];

    const animation = button.animate(keyframes, {
      duration: '500ms',
      easing: 'ease-in-out'
    });

    button.addEventListener('click', () => {
      animation.play();
    });
  </script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions