HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <style> div{ width: 100px; height: 100px; line-height: 5; text-align: center; border: 1px solid #000; background: #39ac39; margin-bottom: 20px; } @-webkit-keyframes myAnimation { from {border-radius: 0%; background: #f69d3c;} to {border-radius: 50%; background: #0066ff} } @keyframes myAnimation { from {border-radius: 0%; background: #f69d3c;} to {border-radius: 50%; background: #0066ff} } </style> </head> <body> <h1>CSS animation-timing-function Property</h1> <div> Div </div> <button onclick="myFunction()">Click Me</button> <script> var x = document.getElementsByTagName("div")[0]; function myFunction(){ x.style.animation = "myAnimation 1s infinite"; x.style.WebkitAnimation = "myAnimation 1s infinite"; x.style.animationDirection = "alternate"; x.style.WebkitAnimationDirection = "alternate"; x.style.animationTimingFunction = "cubic-bezier(0.83, 2.3, 0.31, 0.46)"; x.style.WebkitAnimationTimingFunction = "cubic-bezier(0.83, 2.3, 0.31, 0.46)"; } </script> <p><strong>Note</strong>: Click on the button to start the animation with css 'animation-timing-function' property.</p> </body> </html>
OUTPUT
×

Save as Private