This repository was archived by the owner on Jun 23, 2023. It is now read-only.
File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,7 @@ const autoPlay = (state) => {
137
137
const removeAll = ( ) => {
138
138
_tweens . length = 0
139
139
cancelAnimationFrame ( _tick )
140
+ isStarted = false
140
141
}
141
142
142
143
/**
@@ -180,6 +181,7 @@ const remove = (tween) => {
180
181
}
181
182
if ( _tweens . length === 0 ) {
182
183
cancelAnimationFrame ( _tick )
184
+ isStarted = false
183
185
}
184
186
}
185
187
Original file line number Diff line number Diff line change @@ -202,6 +202,32 @@ test('Tween update should be run against all tween each time', t => {
202
202
t . deepEqual ( order , [ 0 , 1 , 2 ] )
203
203
} )
204
204
205
+ test ( 'Tween should work after recall when using power saving feature' , t => {
206
+ const init = ( obj ) =>
207
+ new Tween ( obj )
208
+ . to ( { z : 360 } , 1000 )
209
+ . on ( 'complete' , init )
210
+ . start ( 0 )
211
+
212
+ const obj1 = { z : 0 }
213
+ init ( obj1 )
214
+
215
+ update ( 500 )
216
+ t . is ( obj1 . z , 180 , 'Tweening update does not work as excepted' )
217
+ update ( 1000 )
218
+ t . is ( obj1 . z , 360 , 'Tweening update does not work as excepted' )
219
+
220
+ update ( 0 )
221
+
222
+ const obj2 = { z : 0 }
223
+ init ( obj2 )
224
+
225
+ update ( 500 )
226
+ t . is ( obj2 . z , 180 , 'Tweening update does not work as excepted' )
227
+ update ( 1000 )
228
+ t . is ( obj2 . z , 360 , 'Tweening update does not work as excepted' )
229
+ } )
230
+
205
231
test ( 'Headless tests' , browserTestMiddleware , ( t , page ) => {
206
232
return page . evaluate ( ( ) => {
207
233
const deepArrayCopy = arr => arr . map ( child => Array . isArray ( child )
You can’t perform that action at this time.
0 commit comments