Animation events: animationend Example
How do I make an animation events: animationend example?
For my blog article http://diessica.com/blog/posts/manipulacao-transicao-animacao-javascript.html. What is a animation events: animationend example? How do you make a animation events: animationend example? This script and codes were developed by Diéssica Gurskas on 10 January 2023, Tuesday.
Animation events: animationend Example - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Animation events: animationend Example</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Open+Sans'> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ #foo { width: 200px; height: 200px; margin: auto; background: #3498db; border-radius: 10%;
}
.old { animation: rotate 2s ease; }
.new { animation: colors 3s; }
@keyframes rotate { 30% { transform: rotateY(180deg) rotate(-180deg); } 70% { transform: rotateY(270deg) rotate(180deg); }
}
@keyframes colors { 10% { background: yellow; } 30% { background: green; } 50% { background: red; } 70% { background: black; } 100% { background: purple; transform: rotate(360deg); }
}
/* não é importante */
body { font-family: 'Open Sans'; color: #fff; width: 450px; margin: 100px auto; text-align: center; background: #2c3e50;
}
pre { background: rgba(0,0,0,0.5); padding: 5px; display: inline-block; font-size: 15px;
}
.msg { margin-top: 25px; background: rgba(0,0,0,0.5); padding: 10px; color: #fff; border-radius: 5px;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <h1>Animation events <pre>animationend</pre></h1>
<div id="foo" class="old"></div> <script src="js/index.js"></script>
</body>
</html>
Animation events: animationend Example - Script Codes CSS Codes
#foo { width: 200px; height: 200px; margin: auto; background: #3498db; border-radius: 10%;
}
.old { animation: rotate 2s ease; }
.new { animation: colors 3s; }
@keyframes rotate { 30% { transform: rotateY(180deg) rotate(-180deg); } 70% { transform: rotateY(270deg) rotate(180deg); }
}
@keyframes colors { 10% { background: yellow; } 30% { background: green; } 50% { background: red; } 70% { background: black; } 100% { background: purple; transform: rotate(360deg); }
}
/* não é importante */
body { font-family: 'Open Sans'; color: #fff; width: 450px; margin: 100px auto; text-align: center; background: #2c3e50;
}
pre { background: rgba(0,0,0,0.5); padding: 5px; display: inline-block; font-size: 15px;
}
.msg { margin-top: 25px; background: rgba(0,0,0,0.5); padding: 10px; color: #fff; border-radius: 5px;
}
Animation events: animationend Example - Script Codes JS Codes
// percorre cada evento como parâmetro da função endAnimation para funcionar no IE10, FF e webkit browsers sem repetir o método
["animationend", "webkitAnimationEnd"].forEach(function(endAnimation) { var foo = document.getElementById('foo'); // assiste a animação do elemento para disparar e executar a função foo.addEventListener(endAnimation, newClass, false);
});
// adiciona uma nova classe ao elemento, substituindo a anterior
function newClass() { // dispara mensagem ao término de cada animação this.insertAdjacentHTML('afterend', "<div class='msg'>Uma animação terminou.</div>"); // adiciona nova classe, substituindo a anterior this.className = "new";
}
Developer | Diéssica Gurskas |
Username | diessica |
Uploaded | January 10, 2023 |
Rating | 3 |
Size | 2,939 Kb |
Views | 6,072 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
CSS Lasers | 4,032 Kb |
CSS is AWESOME | 3,349 Kb |
How checkbox hack works | 4,120 Kb |
Equal Height Columns Sass mixin | 3,861 Kb |
CSS is incredibly awesome | 3,087 Kb |
CSS Sine Waves | 4,102 Kb |
Pure CSS Waves | 3,446 Kb |
Floating labels with CSS only | 3,966 Kb |
A CSS curve | 3,007 Kb |
Tooltip with title attribute | 1,663 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
CSS Donut Charts | Seanstopnik | 2,908 Kb |
A Pen by boilzzz | Boilzzz | 2,761 Kb |
Hello People | Danburrows | 2,365 Kb |
Simple Weather App | Cmwebby | 0 Kb |
Velocity.js custom stagger | Tommiehansen | 4,805 Kb |
HTML5 Breakout | Jaysalvat | 4,873 Kb |
Foundation 5 Menu - Accessibility | Xporter | 1,999 Kb |
Mobile Sub Menu Concept | Berdejitendra | 2,790 Kb |
Modal Dialog | Gigaleet | 2,251 Kb |
NAV WPMANAGER | Mstoic | 1,991 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!