Get started with granim CDN
MIT licensed
Granim is a lightweight library for creating animated gradients and backgrounds.
Tags:- gradient
- animation
Stable version
Copied!
How to start using granim CDN
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
<script src="https://cdn.cdnhub.io/granim/2.0.0/granim.min.js"></script>
</head>
<body>
<button id="btn">Animate</button>
<script>
const btn = document.getElementById('btn');
const gradients = ['#764ba2', '#9c5bd5', '#b388zx', '#c79cf0'];
btn.addEventListener('click', () => {
new Granim({
element: '#canvas',
name: 'granim-gradient-left-to-right',
states: {
'default': {
gradients: gradients,
transitionProperty: 'background',
transitionDuration: 1000,
},
},
}).animateState('default');
});
</script>
<div id="canvas"></div>
</body>
</html>
Copied!
Copied!