Skip to content

Commit 3ebda56

Browse files
committed
bump animejs to one with memory/garbage reduction patches
1 parent eb3506a commit 3ebda56

File tree

4 files changed

+50
-41
lines changed

4 files changed

+50
-41
lines changed

examples/animation/aframe-logo/index.html

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<title>A-Frame Logo</title>
66
<meta name="description" content="A-Frame Logo - A-Frame">
77
<script src="../../../dist/aframe-master.js"></script>
8+
<script src="https://unpkg.com/[email protected]/dist/aframe-event-set-component.min.js"></script>
89
</head>
910
<body>
1011
<a-scene vr-mode-ui="enabled: false;"
@@ -16,7 +17,7 @@
1617
id="tree"
1718
position="0 10 0"
1819
animation="property: object3D.position.y; to: 0; dur: 800; easing: easeOutCubic"
19-
animation__visible="property: visible; to: true; dur: 1"
20+
event-set__loaded="visible: true; _delay: 100"
2021
gltf-model="#treeModel"
2122
scale="2.5 2.5 2.5"
2223
visible="false"></a-mixin>
@@ -32,7 +33,9 @@
3233
<a-entity id="logo" rotation="0 45 0">
3334
<!-- Right side -->
3435
<a-entity animation="property: object3D.scale.y; from: 0.0001; to: 1; delay: 200; dur: 1000; easing: easeOutCubic"
35-
rotation="-20 0 0" position="0 0 10.75" scale="1 0.0001 1">
36+
rotation="-20 0 0" position="0 0 10.75" scale="1 0.0001 1"
37+
event-set__loaded="visible: true; _delay: 300"
38+
visible="false">
3639
<a-box width="12.5" depth="1" height="30" color="#EF2D5E" position="0 15 0">
3740

3841
<!-- Left side -->
@@ -46,7 +49,9 @@
4649

4750
<!-- Cross-bar -->
4851
<a-entity animation="property: object3D.scale.y; from: 0.0001; to: 1; delay: 800; dur: 600; easing: easeOutCubic"
49-
rotation="-90 0 0" position="0 8 7.5" scale="1 0.0001 1">
52+
rotation="-90 0 0" position="0 8 7.5" scale="1 0.0001 1"
53+
event-set__loaded="visible: true; _delay: 500"
54+
visible="false">
5055
<a-box width="12.45" depth=".1" height="14" color="#F2E646" position="0 7 .52" shader="flat"></a-box>
5156
<a-box width="12.5" depth="1" height="14" color="#EF2D5E" position="0 7 0"></a-box>
5257
</a-entity>
@@ -62,7 +67,7 @@
6267

6368
<!-- Behind the A -->
6469
<a-box animation="property: object3D.position.z; to: 100; delay: 1000; dur: 36000"
65-
animation__visible="property: visible; from: false; to: true; delay: 1000; dur: 1"
70+
event-set__loaded="visible: true; _delay: 1000"
6671
position="10 12 -10" color="white" opacity="0.75" width="6" depth="9" height="4" visible="false"></a-box>
6772

6873
<a-box animation="property: object3D.position.z; to: 120; delay: 200; dur: 52000; easing: linear; loop: true"
@@ -89,7 +94,7 @@
8994

9095
<!-- Trees -->
9196
<a-entity position="-10 0.2 -10">
92-
<a-entity mixin="tree" animation="delay: 650" animation__visible="delay: 800"></a-entity>
97+
<a-entity id="tree" mixin="tree" animation="delay: 650" animation__visible="delay: 800"></a-entity>
9398
</a-entity>
9499
<a-entity position="-10 0.2 6">
95100
<a-entity mixin="tree" animation="delay: 400" animation__visible="delay: 400"></a-entity>

examples/showcase/anime-UI/index.html

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
<title>Anime UI</title>
66
<meta name="description" content="Anime UI — A-Frame">
77
<script src="../../../dist/aframe-master.js"></script>
8+
<script src="https://unpkg.com/[email protected]/dist/aframe-event-set-component.min.js"></script>
89
</head>
910
<body>
1011
<a-scene renderer="colorManagement: true;">
1112
<a-assets>
1213
<a-asset-item id="engine" src="models/engine.glb"></a-asset-item>
1314
<a-mixin id="image" geometry="height: 2; width: 2"></a-mixin>
14-
<a-mixin id="toggleAnimation" animation="property: visible; from: false; to: true; dur: 1" visible="false"></a-mixin>
15+
<a-mixin id="delayVisible" event-set__loaded="visible: true" visible="false"></a-mixin>
1516
<audio id="blip1" src="audio/321103__nsstudios__blip1.wav"></audio>
1617
<audio id="blip2" src="audio/321104__nsstudios__blip2.wav"></audio>
1718
<img id="glow1" src="img/glow1.png">
@@ -41,110 +42,110 @@
4142

4243
<a-entity id="wall-lights" position="-7.25 1.5 2.9" rotation="0 90 0" scale="1.25 1.25 1.25">
4344
<a-entity position="0 0 0" scale="0.05 0.05 0.05">
44-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 350"></a-plane>
45+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 350"></a-plane>
4546
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
4647
</a-entity>
4748

4849
<a-entity position="1 0 0" scale="0.05 0.05 0.05">
49-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 400"></a-plane>
50+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 400"></a-plane>
5051
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
5152
</a-entity>
5253

5354
<a-entity position="2 0 0" scale="0.05 0.05 0.05">
54-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 450"></a-plane>
55+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 450"></a-plane>
5556
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
5657
</a-entity>
5758

5859
<a-entity position="3 0 0" scale="0.05 0.05 0.05">
59-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 500"></a-plane>
60+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 500"></a-plane>
6061
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
6162
</a-entity>
6263

6364
<a-entity position="4 0 0" scale="0.05 0.05 0.05">
64-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 550"></a-plane>
65+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 550"></a-plane>
6566
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
6667
</a-entity>
6768

6869
<a-entity position="5 0 0" scale="0.05 0.05 0.05">
69-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 600"></a-plane>
70+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 600"></a-plane>
7071
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
7172
</a-entity>
7273

7374
<a-entity position="6 0 0" scale="0.05 0.05 0.05">
74-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 650"></a-plane>
75+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 650"></a-plane>
7576
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
7677
</a-entity>
7778

7879
<a-entity position="7 0 0" scale="0.05 0.05 0.05">
79-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 700"></a-plane>
80+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 700"></a-plane>
8081
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
8182
</a-entity>
8283

8384
<a-entity position="8 0 0" scale="0.05 0.05 0.05">
84-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 750"></a-plane>
85+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 750"></a-plane>
8586
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
8687
</a-entity>
8788

8889
<a-entity position="9 0 0" scale="0.05 0.05 0.05">
89-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 800"></a-plane>
90+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 800"></a-plane>
9091
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
9192
</a-entity>
9293

9394
<a-entity position="10 0 0" scale="0.05 0.05 0.05">
94-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 850"></a-plane>
95+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 850"></a-plane>
9596
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
9697
</a-entity>
9798

9899
<a-entity position="11 0 0" scale="0.05 0.05 0.05">
99-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 900"></a-plane>
100+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 900"></a-plane>
100101
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
101102
</a-entity>
102103

103104
<a-entity position="12 0 0" scale="0.05 0.05 0.05">
104-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 950"></a-plane>
105+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 950"></a-plane>
105106
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
106107
</a-entity>
107108

108109
<a-entity position="13 0 0" scale="0.05 0.05 0.05">
109-
<a-plane mixin="toggleAnimation" width="1" height="4" shader="flat" color="#B4E2F8" animation="delay: 1000"></a-plane>
110+
<a-plane mixin="delayVisible" width="1" height="4" shader="flat" color="#B4E2F8" event-set__loaded="_delay: 1000"></a-plane>
110111
<a-plane width="6" height="4" color="#586266" opacity="0.6" position="0 0 -.01"></a-plane>
111112
</a-entity>
112113
</a-entity>
113114

114115
<a-entity id="schematic-2" position="0 0 -6" scale="0.7 0.7 0.7">
115-
<a-image mixin="image toggleAnimation" src="#glow1" scale="5 5 5" position="0 0 -2" animation="delay: 1500"></a-image>
116-
<a-image mixin="image toggleAnimation" src="#ring2" scale="1.75 1.75 1.75" position="0 0 -1.2" animation="delay: 1400"></a-image>
117-
<a-image mixin="image toggleAnimation" src="#ring5" scale="1.2 1.2 1.2" position="0 -1.5 -2.1" animation="delay: 1550"></a-image>
118-
<a-image mixin="image toggleAnimation" src="#schematic5" scale="2 2 2" position="2.5 0 -1.02" opacity="0.75" animation="delay: 1500"></a-image>
119-
<a-image mixin="image toggleAnimation" src="#schematic4" scale="1.5 1.5 1.5" position="0 -3 -1.01" rotation="0 0 90" opacity="0.75" animation="delay: 1500"></a-image>
120-
<a-image mixin="image toggleAnimation" src="#schematic3" scale="1 1 1" position="0 2.7 -1" opacity="0.75" animation="delay: 1450"></a-image>
121-
<a-image mixin="image toggleAnimation" src="#schematic1" scale="2 2 2" animation="delay: 1400"></a-image>
122-
<a-image mixin="image toggleAnimation" src="#text2" scale=".5 .5 .5" position="-1 3 .02" animation="delay: 1350"></a-image>
123-
<a-image mixin="image toggleAnimation" src="#text4" position="-2 -2 .03" animation="delay: 1300"></a-image>
116+
<a-image mixin="image delayVisible" src="#glow1" scale="5 5 5" position="0 0 -2" event-set__loaded="_delay: 1500"></a-image>
117+
<a-image mixin="image delayVisible" src="#ring2" scale="1.75 1.75 1.75" position="0 0 -1.2" event-set__loaded="_delay: 1400"></a-image>
118+
<a-image mixin="image delayVisible" src="#ring5" scale="1.2 1.2 1.2" position="0 -1.5 -2.1" event-set__loaded="_delay: 1550"></a-image>
119+
<a-image mixin="image delayVisible" src="#schematic5" scale="2 2 2" position="2.5 0 -1.02" opacity="0.75" event-set__loaded="_delay: 1500"></a-image>
120+
<a-image mixin="image delayVisible" src="#schematic4" scale="1.5 1.5 1.5" position="0 -3 -1.01" rotation="0 0 90" opacity="0.75" event-set__loaded="_delay: 1500"></a-image>
121+
<a-image mixin="image delayVisible" src="#schematic3" scale="1 1 1" position="0 2.7 -1" opacity="0.75" event-set__loaded="_delay: 1450"></a-image>
122+
<a-image mixin="image delayVisible" src="#schematic1" scale="2 2 2" event-set__loaded="_delay: 1400"></a-image>
123+
<a-image mixin="image delayVisible" src="#text2" scale=".5 .5 .5" position="-1 3 .02" event-set__loaded="_delay: 1350"></a-image>
124+
<a-image mixin="image delayVisible" src="#text4" position="-2 -2 .03" event-set__loaded="_delay: 1300"></a-image>
124125
</a-entity>
125126

126127
<a-entity id="schematic-1" position="0 0 -3">
127-
<a-image mixin="image toggleAnimation" src="#schematic2" scale="0.7 0.7 0.7" animation="delay: 1200"></a-image>
128-
<a-image mixin="image toggleAnimation" src="#text1" scale="0.2 0.2 0.2" position="2 0 .02" animation="delay: 1200"></a-image>
129-
<a-image mixin="image toggleAnimation" src="#text3" scale="0.4 0.4 0.4" position="-1 1 .01" animation="delay: 1200"></a-image>
128+
<a-image mixin="image delayVisible" src="#schematic2" scale="0.7 0.7 0.7" event-set__loaded="_delay: 1200"></a-image>
129+
<a-image mixin="image delayVisible" src="#text1" scale="0.2 0.2 0.2" position="2 0 .02" event-set__loaded="_delay: 1200"></a-image>
130+
<a-image mixin="image delayVisible" src="#text3" scale="0.4 0.4 0.4" position="-1 1 .01" event-set__loaded="_delay: 1200"></a-image>
130131
</a-entity>
131132

132133
<a-entity id="rings-group-3" position="0 0 -2" scale="0.5 0.5 0.5">
133-
<a-image mixin="image toggleAnimation" src="#ring3" scale=".8 .8 .8" animation="delay: 1000"></a-image>
134-
<a-image mixin="image toggleAnimation" src="#ring5" scale=".9 .9 .9" position="0 0 .01" animation="delay: 1100"></a-image>
135-
<a-image mixin="image toggleAnimation" src="#ring3" position="0 0 .02" animation="delay: 1100"
134+
<a-image mixin="image delayVisible" src="#ring3" scale=".8 .8 .8" event-set__loaded="_delay: 1000"></a-image>
135+
<a-image mixin="image delayVisible" src="#ring5" scale=".9 .9 .9" position="0 0 .01" event-set__loaded="_delay: 1100"></a-image>
136+
<a-image mixin="image delayVisible" src="#ring3" position="0 0 .02" event-set__loaded="_delay: 1100"
136137
animation__scale="property: scale; from: 1 1 1; to: 1.2 1.2 1.2; delay: 1100; dur: 250; easing: easeOutCubic"></a-image>
137138
</a-entity>
138139

139140
<a-entity id="rings-group-2" position="0 0 -1" scale="0.5 0.5 0.5">
140-
<a-image mixin="image toggleAnimation" src="#ring2" scale="1.2 1.2 1.2" position="0 0 .01" animation="delay: 800"></a-image>
141-
<a-image mixin="image toggleAnimation" src="#text1" scale="0.3 0.3 0.3" position="1.4 0 .02" animation="delay: 900"></a-image>
141+
<a-image mixin="image delayVisible" src="#ring2" scale="1.2 1.2 1.2" position="0 0 .01" event-set__loaded="_delay: 800"></a-image>
142+
<a-image mixin="image delayVisible" src="#text1" scale="0.3 0.3 0.3" position="1.4 0 .02" event-set__loaded="_delay: 900"></a-image>
142143
</a-entity>
143144

144145
<a-entity id="rings-group-1" scale="0.6 0.6 0.6">
145-
<a-image mixin="toggleAnimation" mixin="image" src="#ring5" scale="1.2 1.2 1.2" position="0 0 0" animation="delay: 600"></a-image>
146-
<a-image mixin="toggleAnimation" mixin="image" src="#ring4" scale="1.2 1.2 1.2" position="0 0 .01" animation="delay: 600"></a-image>
147-
<a-image mixin="toggleAnimation" mixin="image" src="#ring3" position="0 0 .02" animation="delay: 700"
146+
<a-image mixin="delayVisible" mixin="image" src="#ring5" scale="1.2 1.2 1.2" position="0 0 0" event-set__loaded="_delay: 600"></a-image>
147+
<a-image mixin="delayVisible" mixin="image" src="#ring4" scale="1.2 1.2 1.2" position="0 0 .01" event-set__loaded="_delay: 600"></a-image>
148+
<a-image mixin="delayVisible" mixin="image" src="#ring3" position="0 0 .02" event-set__loaded="_delay: 700"
148149
animation__scale="property: scale; from: 1 1 1; to: 1.25 1.25 1.25; delay: 700; dur: 250; easing: easeOutCubic"></a-image>
149150
</a-entity>
150151

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"present": "0.0.6",
5151
"promise-polyfill": "^3.1.0",
5252
"style-attr": "^1.0.2",
53+
"super-animejs": "^3.0.0",
5354
"super-three": "^0.101.0",
5455
"three-bmfont-text": "^2.1.0",
5556
"webvr-polyfill": "^0.10.10"

src/components/animation.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var anime = require('animejs');
1+
var anime = require('super-animejs');
22
var components = require('../core/component').components;
33
var registerComponent = require('../core/component').registerComponent;
44
var THREE = require('../lib/three');
@@ -165,6 +165,7 @@ module.exports.Component = registerComponent('animation', {
165165
this.updateConfig();
166166
this.animationIsPlaying = false;
167167
this.animation = anime(this.config);
168+
this.animation.began = true;
168169

169170
this.removeEventListeners();
170171
this.addEventListeners();
@@ -188,6 +189,7 @@ module.exports.Component = registerComponent('animation', {
188189
*/
189190
beginAnimation: function () {
190191
this.updateConfig();
192+
this.animation.began = true;
191193
this.time = 0;
192194
this.animationIsPlaying = true;
193195
this.stopRelatedAnimations();

0 commit comments

Comments
 (0)