Jump to content
Search Community

Gradual RGB color cycle

ngrinchenko test
Moderator Tag

Recommended Posts

Can not figure out what I am doing wrong. I wanted to make a gradual soft RGB color gradation, where one color becomes another and goes through the loop on the screen.

I get colors abruptly jumping from one to another then a soft blend then abrupt jump again, like skipping a step.

How do I make it morph smoothly all the time and what did I do wrong?

 

stop();

import com.greensock.*;
import com.greensock.easing.*;

var main_timeLine:TimelineMax = new TimelineMax({repeat:-1, yoyo:true, timeScale: .3, delay:2 });



main_timeLine.append(TweenMax.from(RGB_halo_mc, .5, {autoAlpha:0, blurFilter:{blurX:20, blurY:20, quality:2}, tint:0x6633cc } ), 0.1 );//purple
main_timeLine.append(TweenMax.from(RGB_halo_mc, .5, {autoAlpha:0, tint:0x0066ff}), 0.1 );//blue
main_timeLine.append(TweenMax.from(RGB_halo_mc, .5, {autoAlpha:0, tint:0x66cc33}), 0.1 );//green
main_timeLine.append(TweenMax.from(RGB_halo_mc, .5, {autoAlpha:0, tint:0xff9900}), 0.1 );//amber
main_timeLine.append(TweenMax.from(RGB_halo_mc, .5, {autoAlpha:0, tint:0xff0000}), 0.1 );//red
main_timeLine.append(TweenMax.from(RGB_halo_mc, .5, {autoAlpha:0, tint:0x66cc33}), 0.1 );//green],

Link to comment
Share on other sites

It's because you're doing from() tweens. Remember, those jump immediately to the value you define, and they use the current value as the destination.

 

And why are you doing autoAlpha:0 on every step?

 

Also, did you intend to do a full tint? I imagine maybe you meant to do the colorMatrixFilter:colorize effect like this:

 

main_timeLine.append(TweenMax.from(RGB_halo_mc, .5, {autoAlpha:0, blurFilter:{blurX:20, blurY:20, quality:2}, tint:0x6633cc } ), 0.1 );//purple
main_timeLine.append(TweenMax.to(RGB_halo_mc, .5, {colorMatrixFilter:{colorize:0x0066ff}}), 0.1 );//blue
main_timeLine.append(TweenMax.to(RGB_halo_mc, .5, {colorMatrixFilter:{colorize:0x66cc33}}), 0.1 );//green
main_timeLine.append(TweenMax.to(RGB_halo_mc, .5, {colorMatrixFilter:{colorize:0xff9900}}), 0.1 );//amber
main_timeLine.append(TweenMax.to(RGB_halo_mc, .5, {colorMatrixFilter:{colorize:0xff0000}}), 0.1 );//red
main_timeLine.append(TweenMax.to(RGB_halo_mc, .5, {colorMatrixFilter:{colorize:0x66cc33}}), 0.1 );//green

 

Better?

Link to comment
Share on other sites

I would recommend that for what you want to do you use TweenLite.to() instead of TweenLite.from().

 

from implies that the color will change from the color you specify TO the current color of the object when the tween values were first recorded. Also, due to the nature of from() tweens and their immediateRender value being set to true, the start and end values of each tween are probably being recorded in a manner that isn't what you expect.

 

using to() tweens will give you the best continuous tint change from one color to another.

Link to comment
Share on other sites

Makes total sense.

I got caught up with the code from the previous color changing set up where I used not a single mc to change colors but few different image based mc to appear on top of another, that is where autoAlpha:0 appeared from....

Same mistake of mine with from() tween because I wanted them to come up the the current image value.

 

Did not occur to me about the colorMatrixFilter:colorize effect.

 

Thanks a lot for a detailed help and a lesson.

Helps me a lot for the future when you broke everything down.

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