You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Since _isPlaying is updated to false after the onComplete callback finishes, the final tween is omitted from the check to determine if all animations have completed
// Since _isPlaying is updated to false after the onComplete callback finishes, the final tween is omitted from the check to determine if all animations have completed
// Since _isPlaying is updated to false after the onComplete callback finishes, the final tween is omitted from the check to determine if all animations have completed
// Since _isPlaying is updated to false after the onComplete callback finishes, the final tween is omitted from the check to determine if all animations have completed
// Since _isPlaying is updated to false after the onComplete callback finishes, the final tween is omitted from the check to determine if all animations have completed
Copy file name to clipboardExpand all lines: src/tests.ts
+47Lines changed: 47 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -2060,6 +2060,53 @@ export const tests = {
2060
2060
test.ok(group.getAll()instanceofArray)
2061
2061
test.done()
2062
2062
},
2063
+
'Custom group.onComplete() should be triggered when all Tweens in the group have reached their completion, and the child Tween.onComplete() should also be fired'(
2064
+
test: Test,
2065
+
): void{
2066
+
TWEEN.removeAll()
2067
+
2068
+
constt=newTWEEN.Tween({x: 1}),
2069
+
t2=newTWEEN.Tween({x: 1},true),
2070
+
group=newTWEEN.Group()
2071
+
letgroupCounter=0,
2072
+
childCounter=0,
2073
+
childCounter2=0
2074
+
2075
+
group.add(t)
2076
+
group.add(t2)
2077
+
2078
+
t.to({x: 2},1000)
2079
+
t2.to({x: 2},2000)
2080
+
2081
+
t.onComplete(function(): void{
2082
+
childCounter++
2083
+
})
2084
+
t2.onComplete(function(): void{
2085
+
childCounter2++
2086
+
})
2087
+
group.onComplete(function(): void{
2088
+
groupCounter++
2089
+
})
2090
+
2091
+
t.start(0)
2092
+
t2.start(0)
2093
+
2094
+
group.update(0)
2095
+
test.deepEqual(groupCounter,0)
2096
+
test.deepEqual(childCounter,0)
2097
+
test.deepEqual(childCounter2,0)
2098
+
2099
+
group.update(1000)
2100
+
test.deepEqual(groupCounter,0)
2101
+
test.deepEqual(childCounter,1)
2102
+
test.deepEqual(childCounter2,0)
2103
+
2104
+
group.update(2000)
2105
+
test.deepEqual(childCounter,1)
2106
+
test.deepEqual(groupCounter,1)
2107
+
test.deepEqual(childCounter2,1)
2108
+
test.done()
2109
+
},
2063
2110
2064
2111
'Custom group stores tweens instead of global TWEEN group'(test: Test): void{
0 commit comments