-
Notifications
You must be signed in to change notification settings - Fork 2
/
AnimeJS101.html
109 lines (92 loc) · 2.79 KB
/
AnimeJS101.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AnimeJS testing</title>
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/anime.min.js"></script>
<style>
#box1 {
background-color: cadetblue;
}
#box2 {
background-color: lightcoral;
}
#box3 {
background-color: lightslategrey;
}
.boxes {
border: 2px solid black;
width: 100px;
height: 100px;
z-index: 9999;
position: relative;
}
</style>
</head>
<body>
<div id="box1" class="boxes"></div>
<div id="box2" class="boxes"></div>
<div id="box3" class="boxes"></div>
<a-scene>
<a-box id="abox1" color="red" position="0 1.5 -5"></a-box>
</a-scene>
<script>
let position = {
x: 0, y:0, z:0
};
anime( {
targets : position,
z : -20,
duration : 5000,
update : function () {
console.log(position.z);
let box = document.querySelector("#abox1");
box.setAttribute('position', `0 0 ${position.z}`);
}
});
// anime({
// targets: "#abox1",
// position: [
// { value: "2 1.5 -3" , duration : 5000 },
// { value: "-2 1.5 -3" },
// { value: "-2 1.5 -10" },
// { value: "2 1.5 -10" },
// ],
// rotation: [
// { value: "0 0 0 " , duration : 5000 },
// { value: "0 360 0 " },
// { value: "360 0 0 " },
// { value: "0 0 360 " },
// ],
// })
// anime({
// targets : "#abox1",
// keyframes : [
// {position : "2 1.5 -3"},
// {position : "-2 1.5 -3"},
// {position : "-2 1.5 -10"},
// {position : "2 1.5 -10"},
// ],
// duration : 5000
// });
// anime ( {
// targets : "#abox1",
// position : ["0 1.5 -5", " 2 1.5 -3"],
// duration : 3000
// });
// anime({
// //adalah parameter animasi
// targets : "#box2",
// // width : 600 //css Property
// translateX : 300, // css transform
// // object property / dom attribute
// // svg attribute
// duration : 5000,
// delay : 1000
// });
</script>
</body>
</html>