This repository was archived by the owner on Nov 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -4062,7 +4062,9 @@ export default (gopt: KaboomOpt = {}): KaboomCtx => {
40624062
40634063 let spriteData : SpriteData | null = null
40644064 let curAnim : SpriteCurAnim | null = null
4065- let curAnimDir : - 1 | 1 | null = null // 1 - from small index to large index; -1 - reverse
4065+ // 1 - from small index to large index
4066+ // -1 - reverse
4067+ let curAnimDir : - 1 | 1 | null = null
40664068 const spriteLoadedEvent = new Event < [ SpriteData ] > ( )
40674069
40684070 if ( ! src ) {
@@ -4225,25 +4227,27 @@ export default (gopt: KaboomOpt = {}): KaboomCtx => {
42254227 curAnim . timer += dt ( ) * this . animSpeed
42264228
42274229 if ( curAnim . timer >= ( 1 / curAnim . speed ) ) {
4228- curAnim . timer = 0
42294230
4231+ curAnim . timer = 0
42304232 this . frame += curAnimDir
42314233
4232- if ( this . frame < Math . min ( anim . from , anim . to ) || this . frame > Math . max ( anim . from , anim . to ) ) {
4234+ if ( this . frame < Math . min ( anim . from , anim . to ) ||
4235+ this . frame > Math . max ( anim . from , anim . to ) ) {
42334236 if ( curAnim . loop ) {
42344237 if ( curAnim . pingpong ) {
4238+ this . frame -= curAnimDir
42354239 curAnimDir *= - 1
42364240 this . frame += curAnimDir
4237- this . frame += curAnimDir
42384241 } else {
42394242 this . frame = anim . from
42404243 }
42414244 } else {
4242- this . frame -= curAnimDir
4245+ this . frame = anim . to
42434246 curAnim . onEnd ( )
42444247 this . stop ( )
42454248 }
42464249 }
4250+
42474251 }
42484252
42494253 } ,
Original file line number Diff line number Diff line change @@ -2615,7 +2615,7 @@ export interface GameObjRaw {
26152615 * Gather debug info of all comps.
26162616 */
26172617 inspect ( ) : GameObjInspect ,
2618- /**
2618+ /**
26192619 * Register an event that runs when the game obj is added to the scene.
26202620 */
26212621 onAdd ( action : ( ) => void ) : EventController ,
You can’t perform that action at this time.
0 commit comments