Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

add callback examples

Julian Garnier2beaeb3fcebc
diff --git a/examples/callbacks.html b/examples/callbacks.html
new file mode 100644
index 00000000..7ea00a46
--- /dev/null
+++ b/examples/callbacks.html
@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>anime.js</title>
+ <meta charset="utf-8">
+ <link rel="icon" type="image/png" href="img/favicon.png" />
+ <link rel="apple-touch-icon" href="img/apple-touch-icon.png" />
+ <link href="css/styles.css" rel="stylesheet">
+</head>
+<body>
+ <section>
+ <article>
+ <div class="blue"></div>
+ <div class="red"></div>
+ <div class="green"></div>
+ </article>
+ </section>
+ <script src="../anime.js"></script>
+ <script>
+
+ var blueAnimation = anime({
+ targets: '.blue',
+ translateX: 200,
+ direction: 'alternate',
+ autoplay: false
+ });
+
+ var redAnimation = anime({
+ targets: '.red',
+ translateX: 200,
+ direction: 'alternate',
+ autoplay: false
+ });
+
+ var greenAnimation = anime({
+ targets: '.green',
+ translateX: 200,
+ direction: 'alternate',
+ autoplay: false
+ });
+
+ blueAnimation.settings.complete = function() {
+ greenAnimation.restart();
+ }
+
+ redAnimation.settings.complete = function() {
+ blueAnimation.restart();
+ }
+
+ greenAnimation.settings.complete = function() {
+ redAnimation.restart();
+ }
+
+ greenAnimation.play();
+
+ </script>
+</body>
+</html>
diff --git a/examples/css/styles.css b/examples/css/styles.css
index ff2cec05..6c9fc85c 100644
--- a/examples/css/styles.css
+++ b/examples/css/styles.css
@@ -40,6 +40,11 @@ section {
min-width: 18rem;
}
+div {
+ width: 2rem;
+ height: 2rem;
+}
+
.red {
background-color: #FF324A;
}