Animation delay

Hello everyone,

I’m trying to make a simple game using a script, I made a delay for some planes when the game starts, how do I make the delay disappear when the game ends?

I’m using @pofu.lu pftween script 3000 and 2600 are the delay.

thank you!

1 Like

You can watch this video if you don’t understand what I mean.

If you use the following way to apply animation:

plane0.transoform.x = new PFTween(0, 1, 1000).setDelay(2600).scalar;

You just need to assign the last value to target transform itself:

plane0.transform.x = plane0.transform.x.pinLastValue();

If you apply value with .onStart() or .bind() like this:

new PFTween(0 ,1, 1000)
    .setDelay(2600)
    .onStart(v => plane0.transform.x = v.scalar) // or bind()
    .build() // or apply()

You can save it in a var so you can stop it:

const tweener = new PFTween(0 ,1, 1000)
    .setDelay(2600)
    .onStart(v => plane0.transform.x = v.scalar) // or bind()
    .build() // or apply()

tweener.stop() // stop animation

or .setId() then kill it:

new PFTween(0 ,1, 1000)
    .setDelay(2600)
    .setId('my loop wall')
    .onStart(v => plane0.transform.x = v.scalar) // or bind()
    .build() // or apply()

PFTween.kill('my loop wall');

More reference: GitHub - pofulu/sparkar-pftween: A Spark AR tween animation tool.

4 Likes

Solved! Thanks pofu!

2 Likes