Share Posted June 7, 2020 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 More sharing options...
Share Posted June 8, 2020 Hey isladjan. I'm not understanding what you're asking or what you're trying to accomplish. Can you please try to create a minimal demo displaying your situation? Link to comment Share on other sites More sharing options...
Author Share Posted June 9, 2020 Nevermind I found a solution. Sorry to bother you Link to comment Share on other sites More sharing options...
Share Posted June 9, 2020 Can you please share you solution so that other people reading in the future may benefit as well? Link to comment Share on other sites More sharing options...
Author Share Posted June 16, 2020 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 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now