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
// After the onComplete callback completes, _isPlaying is updated to false, so if the total number of completed tweens is -1, then they are all complete.
// After the onComplete callback completes, _isPlaying is updated to false, so if the total number of completed tweens is -1, then they are all complete.
// After the onComplete callback completes, _isPlaying is updated to false, so if the total number of completed tweens is -1, then they are all complete.
// After the onComplete callback completes, _isPlaying is updated to false, so if the total number of completed tweens is -1, then they are all complete.
// After the onComplete callback completes, _isPlaying is updated to false, so if the total number of completed tweens is -1, then they are all complete.
Copy file name to clipboardExpand all lines: src/tests.ts
+64
Original file line number
Diff line number
Diff line change
@@ -2060,6 +2060,70 @@ 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}),
2070
+
t3=newTWEEN.Tween({x: 1}),
2071
+
group=newTWEEN.Group()
2072
+
letgroupCounter=0,
2073
+
childCounter=0,
2074
+
childCounter2=0,
2075
+
childCounter3=0
2076
+
2077
+
group.add(t)
2078
+
group.add(t2)
2079
+
group.add(t3)
2080
+
2081
+
t.to({x: 2},1000)
2082
+
t2.to({x: 2},2000)
2083
+
t3.to({x: 2},3000)
2084
+
2085
+
t.onComplete(function(): void{
2086
+
childCounter++
2087
+
})
2088
+
t2.onComplete(function(): void{
2089
+
childCounter2++
2090
+
})
2091
+
t3.onComplete(function(): void{
2092
+
childCounter3++
2093
+
})
2094
+
group.onComplete(function(): void{
2095
+
groupCounter++
2096
+
})
2097
+
2098
+
t.start(0)
2099
+
t2.start(0)
2100
+
t3.start(0)
2101
+
2102
+
group.update(0)
2103
+
test.deepEqual(groupCounter,0)
2104
+
test.deepEqual(childCounter,0)
2105
+
test.deepEqual(childCounter2,0)
2106
+
test.deepEqual(childCounter3,0)
2107
+
2108
+
group.update(1000)
2109
+
test.deepEqual(groupCounter,0)
2110
+
test.deepEqual(childCounter,1)
2111
+
test.deepEqual(childCounter2,0)
2112
+
test.deepEqual(childCounter3,0)
2113
+
2114
+
group.update(2000)
2115
+
test.deepEqual(childCounter,1)
2116
+
test.deepEqual(groupCounter,0)
2117
+
test.deepEqual(childCounter2,1)
2118
+
test.deepEqual(childCounter3,0)
2119
+
2120
+
group.update(3000)
2121
+
test.deepEqual(groupCounter,1)
2122
+
test.deepEqual(childCounter,1)
2123
+
test.deepEqual(childCounter2,1)
2124
+
test.deepEqual(childCounter3,1)
2125
+
test.done()
2126
+
},
2063
2127
2064
2128
'Custom group stores tweens instead of global TWEEN group'(test: Test): void{
0 commit comments