Jump to content
Search Community

Pixi.js RGB color transform with GSAP 3.0

Jason Sturges test
Moderator Tag

Recommended Posts

Not sure I follow how to shift between colors with GSAP 3.0 using RGB values in Pixi.js

 

Whether I use tintor my color property to change color, it tweens the RGB hex value as a single integer, creating a wobbly flashing transition of colors.

 

colors.gif.31857d9fc91fcd9826e1dcc6738f0208.gif

 

Code:

import * as PIXI from "pixi.js";
import { Power4, TimelineMax } from "gsap"; 
import PixiPlugin from "gsap/PixiPlugin";

PixiPlugin.registerPIXI(PIXI);

// ...

this._tween = new TimelineMax({ repeat: -1 })
  .to(this, 1, {
    color: 0xffff00,
    ease: Power4.easeIn
  });

Seems like GSAP 3.0 relies on auto-detection of color properties instead of previous plugins, like color transform or color props plugins.

 

Is there a trick, or some way I can pass a custom function as frame handler to the tween function?

Link to comment
Share on other sites

Oh, and don't forget to register the PixiPlugin. 

 

import * as PIXI from "pixi.js";
import gsap from "gsap"; 
import PixiPlugin from "gsap/PixiPlugin";

gsap.registerPlugin(PixiPlugin);
PixiPlugin.registerPIXI(PIXI);

this._tween = gsap.timeline({ repeat: -1 })
  .to(this, {
    pixi: {
    	tint: 0xffff00
    },
    duration: 1,
    ease: "power4.in"
  });

 

  • 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...