all groups > flash actionscript > february 2004 >
You're in the

flash actionscript

group:

animating saturation


animating saturation spdorsey
2/14/2004 8:44:15 PM
flash actionscript:
New to Flash = bear with me

I'm trying to create a script that will change an RGB color to 50% grey. In
other words, I'd like to move a (R,G,B) value to (128,128,128).

I've looked all over, and I cannot find the proper syntax for referring to
RGB color values in a way that can be animated. If anyone has any input, it
would be much appreciated

Thanks

---------------------------
Re: animating saturation abeall
2/14/2004 10:20:01 PM
you said script, so I guess you're trying to make a cool dynamic script that
can take anything and make it half grey? Or are you simply trying to animate
something to half grey? If it's the second, then that can be easily done by
converting to a movieClip symbol(hotkey: F8 in MX) then doing a tint color
motion tween

but it you want the first thing I said, that will be a little trickier,
especially if you're dealing with groups of colors(image); but you did say "an
RGB color". You should check out the color object in the user F1 reference. A
possible alternative might be to make two images, one normal, the other greyed,
then simple alpha fade one on top of the other

HT
Re: animating saturation spdorsey
2/14/2004 10:30:29 PM
I have 4 movie clips which are currently 4 different colors. I'd need to change
each of them to gray gradually over about 1 second of time after the user
mouses over one of 4 icons on the screen. When the user mouses off, the grays
return to color

Is it possible to animate a tint? I didn't see a "_tint" property

Thanks

--------------------------
Re: animating saturation Carixpig
2/15/2004 3:43:08 AM
You can control tint using actionscript. Put this script on your Actions layer
and put a movieclip with the instance name "myMovieClip" on the stage. Make
sure it is not black or there will be no change

myColor = new Color(myMovieClip)
myMovieClip.onEnterFrame = function()
colorDefine = new Object()
colorDefine.ra = tintIncrease
colorDefine.ga = tintIncrease
colorDefine.ba = tintIncrease
myColor.setTransform(colorDefine)
tintIncrease += value

myMovieClip.onRollOver = function()
if(tintIncrease <= 100)
value = 10
}else
value = 0


myMovieClip.onRollOut = function()
if(tintIncrease >= 0)
value = -10
}else
value = 0



Play around with the numbers until you get the speed and tint you want
Re: animating saturation abeall
2/16/2004 3:17:43 AM
Re: animating saturation abeall
2/16/2004 3:22:26 AM
Do you understand about Flash's multiple timeline's? Basically, you can easily
keep your main movie to have 1 keyframe, but make MovieClip symbols(select an
object, press F8, select type to be MovieClip) then open it up by double
clicking. You now have a fresh timeline that is independant from the main
timeline. Keyframe away, then when you go back to the main movie it's still one
keyframe. Stick the MC into a button symbol's Over or Up state and that's the
easy way to get an animated button

You might already know all that. spdorsey's script will work great, I'm just
not a hardcore scripter by choice, and would prefer the keyframe method, but if
it's your style then great

good luc
Re: animating saturation Pete Hughes
2/16/2004 1:16:14 PM
There are all sorts of color picker examples and tutes, all of which manipulate
the color values of a movie clip, including saturation. A good example is at
http://www.peterjoel.com/Samples/ . Working with colors doesn't require much
more than knowledge of the Color object, and the ability to use ratios
Re: animating saturation Pete Hughes
2/16/2004 1:28:21 PM
I did forget one thing. I converted RGB to a pseudo-HSB. That allowed me to
work on the saturation directly. I suppose Peter Joel's example does the same
thing but let me know if you need more information
AddThis Social Bookmark Button