Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Add valid targets value examples

Julian Garnier0182ecd517c9
diff --git a/examples/basic-animations.html b/examples/basic-animation-settings.html
similarity index 95%
rename from examples/basic-animations.html
rename to examples/basic-animation-settings.html
index 4c5b161c..9e3e8296 100644
--- a/examples/basic-animations.html
+++ b/examples/basic-animation-settings.html
@@ -1,19 +1,17 @@
<!DOCTYPE html>
<html>
<head>
- <title>Basic animations | anime.js</title>
+ <title>Basic animation settings | 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>
-<style>
-
-
-</style>
-
<body>
- <div class="cells">
+ <header>
+ <h1 class="page-title">Basic animation settings</h1>
+ </header>
+ <section class="cells">
<div class="cell w-02 h-02 color-01">
<div class="demo">
<div class="el shadow"></div>
@@ -77,7 +75,7 @@
</div>
<h3 class="demo-title">Infinite loop reverse</h3>
</div>
- </div>
+ </section>
<script src="../anime.js"></script>
<script>
diff --git a/examples/css/styles.css b/examples/css/styles.css
index 60a8387d..2540dea2 100644
--- a/examples/css/styles.css
+++ b/examples/css/styles.css
@@ -14,9 +14,6 @@ body {
body {
position: absolute;
display: flex;
- align-items: center;
- justify-content: center;
- flex-wrap: wrap;
width: 100%;
height: 100%;
color: white;
@@ -24,6 +21,29 @@ body {
-webkit-font-smoothing: antialiased;
}
+header {
+ display: flex;
+ align-items: center;
+ width: 100%;
+ height: 80px;
+}
+
+.page-title {
+ display: block;
+ padding-left: 20px;
+ font-size: 30px;
+ font-weight: 200;
+ text-transform: uppercase;
+}
+
+.demo-title {
+ display: block;
+ width: 100%;
+ padding: 1rem;
+ text-align: center;
+ text-transform: uppercase;
+}
+
.cells {
position: absolute;
display: flex;
@@ -31,7 +51,8 @@ body {
justify-content: center;
flex-wrap: wrap;
width: 100%;
- height: 100%;
+ top: 80px;
+ bottom: 0;
border-top: 1px solid #09090B;
border-left: 1px solid #09090B;
}
@@ -54,23 +75,24 @@ body {
justify-content: flex-start;
flex-direction: row;
flex-wrap: wrap;
- width: 300px;
+ width: 290px;
+ padding: 30px 0;
flex: 1;
}
-.demo-title {
- position: absolute;
- bottom: 0;
- display: block;
+.line {
width: 100%;
- padding: 1rem;
- text-align: center;
- text-transform: uppercase;
}
.el {
- width: 50px;
- height: 50px;
+ width: 40px;
+ height: 40px;
+}
+
+.line .el {
+ width: 20px;
+ height: 20px;
+ margin: 1px;
}
.el.shadow {
@@ -78,6 +100,16 @@ body {
opacity: .2;
}
+.object-data {
+ width: 100%;
+ border: none;
+ font-size: 30px;
+ font-weight: 200;
+ font-family: monospace;
+ text-align: left;
+ background: transparent;
+}
+
.w-01 { width: 16.666666667%; }
.w-02 { width: 33.333333333%; }
.w-03 { width: 50%; }
@@ -92,27 +124,39 @@ body {
.h-05 { height: 83.333333333%; }
.h-06 { height: 100%; }
-.color-01 { color: #FF3478; }
+.color-01,
+.color-01 input { color: #FF3478; }
.color-01 .el { background-color: #FF3478; }
-.color-02 { color: #F96F82; }
+.color-02,
+.color-02 input { color: #F96F82; }
.color-02 .el { background-color: #F96F82; }
-.color-03 { color: #FEA388; }
+.color-03,
+.color-03 input { color: #FEA388; }
.color-03 .el { background-color: #FEA388; }
-.color-04 { color: #FED28B; }
+.color-04,
+.color-04 input { color: #FED28B; }
.color-04 .el { background-color: #FED28B; }
-.color-05 { color: #FBF88F; }
+.color-05,
+.color-05 input { color: #FBF88F; }
.color-05 .el { background-color: #FBF88F; }
-.color-06 { color: #D1FA9E; }
+.color-06,
+.color-06 input { color: #D1FA9E; }
.color-06 .el { background-color: #D1FA9E; }
-.color-07 { color: #8AFBB1; }
+.color-07,
+.color-07 input { color: #8AFBB1; }
.color-07 .el { background-color: #8AFBB1; }
-.color-08 { color: #7BE6D6; }
+.color-08,
+.color-08 input { color: #7BE6D6; }
.color-08 .el { background-color: #7BE6D6; }
-.color-09 { color: #67AAFB; }
+.color-09,
+.color-09 input { color: #67AAFB; }
.color-09 .el { background-color: #67AAFB; }
-.color-10 { color: #4E7EFC; }
+.color-10,
+.color-10 input { color: #4E7EFC; }
.color-10 .el { background-color: #4E7EFC; }
-.color-11 { color: #957FFD; }
+.color-11,
+.color-11 input { color: #957FFD; }
.color-11 .el { background-color: #957FFD; }
-.color-12 { color: #C987FE; }
+.color-12,
+.color-12 input { color: #C987FE; }
.color-12 .el { background-color: #C987FE; }
diff --git a/examples/different-targets-types.html b/examples/different-targets-types.html
new file mode 100644
index 00000000..c032008a
--- /dev/null
+++ b/examples/different-targets-types.html
@@ -0,0 +1,124 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Valid targets types | 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>
+<style>
+
+
+</style>
+
+<body>
+ <header>
+ <h1 class="page-title">Valid targets types</h1>
+ </header>
+ <section class="cells">
+ <div class="cell w-03 h-02 color-01">
+ <div class="demo">
+ <div class="el shadow"></div>
+ <div class="el css-selector"></div>
+ </div>
+ <h3 class="demo-title">CSS selector</h3>
+ </div>
+ <div class="cell w-03 h-02 color-02">
+ <div class="demo">
+ <div class="el shadow"></div>
+ <div class="el dom-node"></div>
+ </div>
+ <h3 class="demo-title">DOM Node</h3>
+ </div>
+ <div class="cell w-03 h-02 color-04">
+ <div class="demo">
+ <div class="line">
+ <div class="el shadow"></div>
+ <div class="el node-list"></div>
+ </div>
+ <div class="line">
+ <div class="el shadow"></div>
+ <div class="el node-list"></div>
+ </div>
+ <div class="line">
+ <div class="el shadow"></div>
+ <div class="el node-list"></div>
+ </div>
+ </div>
+ <h3 class="demo-title">Node List</h3>
+ </div>
+ <div class="cell w-03 h-02">
+ <div class="demo">
+ <div class="line color-05">
+ <div class="el shadow"></div>
+ <div class="el array"></div>
+ </div>
+ <div class="line color-06">
+ <div class="el shadow"></div>
+ <div class="el array"></div>
+ </div>
+ <div class="line color-07">
+ <div class="el shadow"></div>
+ <div class="el array"></div>
+ </div>
+ </div>
+ <h3 class="demo-title color-07">JavaScript Array</h3>
+ </div>
+ <div class="cell w-06 h-02 color-03">
+ <div class="demo">
+ <div class="object-data"></div>
+ </div>
+ <h3 class="demo-title">JavaScript Object Value</h3>
+ </div>
+ </section>
+ <script src="../anime.js"></script>
+ <script>
+
+ anime({
+ targets: '.css-selector',
+ translateX: 250,
+ direction: 'alternate',
+ loop: true,
+ });
+
+ anime({
+ targets: document.querySelector('.dom-node'),
+ translateX: 250,
+ direction: 'alternate',
+ loop: true,
+ });
+
+ anime({
+ targets: document.querySelectorAll('.node-list'),
+ translateX: 270,
+ direction: 'alternate',
+ loop: true,
+ });
+
+ var el = document.querySelector('.color-06 .array')
+
+ anime({
+ targets: ['.color-05 .array', el, document.querySelector('.color-07 .array')],
+ translateX: 270,
+ direction: 'alternate',
+ loop: true,
+ });
+
+ var myObject = { data: 2000 };
+
+ anime({
+ targets: myObject,
+ data: 42,
+ direction: 'alternate',
+ loop: true,
+ round: 1000,
+ update: function() {
+ var el = document.querySelector('.object-data');
+ el.innerHTML = 'myObject = {<br>&nbsp;&nbsp;data: '+myObject.data+'<br>}';
+ }
+ });
+
+ </script>
+</body>
+</html>