pixi-ease icon indicating copy to clipboard operation
pixi-ease copied to clipboard

each loop event with repeat

Open lumenier1 opened this issue 3 years ago • 2 comments
trafficstars

import * as PIXI from 'pixi.js'
import { Ease, ease } from 'pixi-ease'

const app = new PIXI.Application()
const test = app.stage.addChild(new PIXI.Sprite(PIXI.Texture.WHITE))
const generic = ease.add(test, { alpha: 0 }, { duration: 1500, repeat: true, ease: 'easeOutQuad' })
generic.on('each', () => console.log(test.generic))

Docs are saying that: fires on each loop when there are eases running

But it fires on each tick (every frame).

So, how to catch an event when the current loop of repetitive animation is completed (event between each repetitive loop)?

lumenier1 avatar Dec 11 '21 17:12 lumenier1

The easing emits the repeat event. I think that's what you're looking for:

generic.on('repeat', () => doSomething())

davidfig avatar Dec 11 '21 18:12 davidfig

Thanks for the reply.

The easing emits the repeat event. I think that's what you're looking for:

generic.on('repeat', () => doSomething())

Unfortunately, this doesn't work.

Also it would be great to add new parameter repeatDelay for the add() method like so:

ease.add(test, { alpha: 0 }, { duration: 1500, repeat: true, repeatDelay: 500, ease: 'easeOutQuad' })

lumenier1 avatar Dec 11 '21 19:12 lumenier1