Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Add example for new states syntax

Julian Garnier67d691e911b7
diff --git a/documentation/examples/anime-timeline.html b/documentation/examples/anime-timeline.html
index 3b41f28a..a51383b4 100644
--- a/documentation/examples/anime-timeline.html
+++ b/documentation/examples/anime-timeline.html
@@ -16,7 +16,7 @@
<link rel="apple-touch-icon-precomposed" href="../assets/img/icons/apple-touch-icon.png">
<link rel="icon" type="image/png" href="../assets/img/icons/favicon.png" >
<link href="../assets/css/documentation.css" rel="stylesheet">
- <script src="../../lib/anime.min.js"></script>
+ <!-- <script src="../../lib/anime.min.js"></script> -->
<!-- <script src="../assets/js/anime/anime.2.2.0.js"></script> -->
<style>
@@ -89,7 +89,9 @@
</div>
</body>
-<script>
+<script type="module">
+
+ import anime from '../../src/index.js';
var els = document.querySelectorAll('.el');
var controlsProgressEl = document.querySelector('.controls .progress');
diff --git a/src/states-new-syntax.js b/src/states-new-syntax.js
new file mode 100644
index 00000000..4e25b1f1
--- /dev/null
+++ b/src/states-new-syntax.js
@@ -0,0 +1,20 @@
+var animation = anime({
+ targets: '.modal',
+ states: {
+ closed: {
+ width: 100,
+ height: 100,
+ easing: 'easeInOutExpo'
+ },
+ opened: {
+ width: '100vw',
+ height: '100vh'
+ }
+ },
+ duration: 2000,
+ easing: 'easeOutExpo'
+})
+
+animation.goTo('closed');
+
+animation.animateTo('open');
\ No newline at end of file