Jump to content
Search Community

update value in onComplete callback -pixi Plugin

isladjan test
Moderator Tag

Recommended Posts

How to update value in onComplete callback? I am using gsap 3, pixi.js and Pixi Plugin.

 

I try a few things but it seems nothing works (tween overwrite, modifiers and updateTo() method).

 

I have something like this:

let frame = 0;

function animate() {

    gsap.to(container, {
        pixi: { scale: scale, rotation: angle, x: x, y: y },
        duration: 1.7,
        ease: "power3.in",

        onComplete: () => {
            //reset value
            gsap.set(scene, { pixi: { scale: 1, rotation: 0, x: app.screen.width / 2 } });   

            if (frame < 3) animate();         
            else animate2()
        }
    });
	
    frame++
}

 

I need when onComplete trigger, to gsap.set(..) use current value of app.screen.width  ( width of render in pixi.js which change on resize event).

Link to comment
Share on other sites

Like I said, I try a few things but  nothing works. I think  problem is in Pixi Plugin. Without Pixi Plugina, but with Pixi.js and only gsap, you can overwrite tween (make function which recreate that same tween) and this way dynamically update certain value in onComplete.

 

In my example I chose the easiest way, change value through PIXI.js.

See the Pen pogjGNa by isladjan (@isladjan) on CodePen

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...