TweenFilterLite (deprecated)
Notice: TweenFilterLite has been deprecated because of the new plugin architecture in TweenLite and TweenMax
There is nothing that TweenFilterLite could do that TweenLite can’t do now with the appropriate plugins activated.
Comments (22)

Jack
many thanks for sharing your hard work. Having found the MC Tween class to be hugely timesaving and extremely useful I was looking for somthing that could product similar effects on color and brightness properties.
I’m sure it will become a key tool in future development
Regards
Robert
Jack, thanks for creating this handy class. I can already tell that it will save me a fair amount of time. I’ll be sure to let you know if I publish anything that uses the class.
Hello Jack, i just want to say a “thank you” here too, because i’m really amazed about your work and your helpfull mentality, love your tween, its a big help to me.
regards
Zsolt
For those of you who want to use this class in Flex … ITS EASY.
Flex does not allow you to add to the Application stage a MovieClip and this class uses a MovieClip for all of its methods ….
Solution:
Simply subclass any class you want ( for example ) and than continue by implementing two public methods in this class as follows:
public function set quality(i:int):void {}
public function get quality():int {
return 1;
}
That’s it …
Now use your class instead of MC.
Enjoy.
Sean – HeliHobby.com
great class and all, it’s the best in terms of filesize and simplicity, BUT:
sometimes (and it really is _essentially_ random) it throws an error
TypeError: Error #1010: A term is undefined and has no properties.
at gs::TweenFilterLite/render()
at gs::TweenLite$/executeAll()
when trying to tween blur filter. it stops execution of the tween and usually occurs when tweening blur filter of more than 40 instances at once.
and this has been a real pain in the ass!!
blogk, after many hours of banging my head against the screen and trying to chase down the rare (and apparently completely random) 1010 error that TweenFilterLite throws from time to time in specific scenarios, I think I’ve figured it out. Actually, I’m almost positive it was caused by a bug in Flash but I whipped together a workaround and implemented it in version 5.5 of the class.
Thanks for the feedback.
I have a problem using TweenFilterLite with textFields…
TweenFilterLite.to(someTextField,2,{type:”glow”,color:0×0000FF,blurX:20,blurY:10,strength:100});
I constantly get:
ArgumentError: Error #2008: Parameter type must be one of the accepted values.
at flash.text::TextField/set type()
at gs::TweenFilterLite/render()
at gs::TweenLite$/executeAll()
Felixz, great catch. As of version 5.84, the error is fixed and you can now tween filters on TextFields.
Another quickie, Jack:
Could you post a quick tut on sound tweening of loaded mp3s (with other tweens running as well)? I’ve messed around with both the loaded sound as well as a SoundChannel, but a desired volume tween doesn’t seem to work. Or is this only possible with the newest version?
Thanks again.
– Tony
Tony, tweening audio volume can be done two ways:
1) On a MovieClip that contains audio. This is as simple as:
TweenLite.to(myMovieClip, 2, {volume:0});
2) On a SoundChannel object.This is likely what you’d do with the MP3s you loaded in. When you play() your audio, it returns a SoundChannel object, so once you’ve loaded your MP3, it should be as easy as:
var myChannel = mySound.play();
TweenLite.to(myChannel, 2, {volume:0});
Keep in mind, you’re NOT tweening the Sound object – you’re tweening the SoundChannel object.
How can I set it to loop and change colors ramdonly or using an aray of colors?
Awesome work.
John, you could accomplish what you’re after with something like:
var myColors:Array = [0xFF0000, 0x00FF00, 0x0000FF];
function tweenColor():void {
var randomColor = myColors[Math.floor(Math.random() * myColors.length)];
TweenFilterLite.to(my_mc, 2, {colorMatrixFilter:{colorize:randomColor, amount:2}, onComplete:tweenColor});
}
tweenColor();
Hi there i have added an additional class for those who wish to use Events. This is a seperate class – so just use this instead of TweenLite.
A data object is dispatched with the Event so you can still pass around onStartParams etc in the usual way but just pick them up from the event listener.
hope this is some good to you event loving types.
http://biffcom.com/resource/tweenLiteEventMod/TweenLiteEventModExample.zip
Thanks,
Biffer Rowley
John:
Or you could just randomize the “hue” color parameter which is handily a 0-360 scale in TweenFilterLite:
theHue = (Math.round(Math.random() * 360)) ;
TweenFilterLite.to(my_mc, 2, {colorMatrixFilter:{amount:1, hue:theHue}});
You can enhance the effect with the brightness parameter as well (-1 to 1 scale). Very cool result with sky images.
–Tony
How i can dublicate effect like flash bulb. It is simple in Tweener.
Tweener.addTween(_loader,{_color_rb:255, _color_gb:255, _color_bb:255, time:1, transition:”easeOutQuad”});
I try use brightness with param 3 but result is poor for me.
Nicolas, you can definitely create the effect you’re looking for using the ColorTransformProxy utility class I created for use in conjunction with TweenLite for tweening all the various ColorTransform-related properties, including redOffset, greenOffset, blueOffset, redMultiplier, greenMultiplier, blueMultiplier, tint, and even tintPercent and brightness!. Sign up for Club GreenSock and you’ll get that class as a bonus (as well as a TrasnformMatrixProxy class). See http://blog.greensock.com/club/ for details.
Thanks for providing this! Fantastic tool.
Jack, thanks for creating these great classes. You’ve saved me hours of time. If you’re ever in Chicago, I owe you a beer.
I’ve been looking for a solid animation package to accompany AS3 projects and I think I’ve finally found it. Kudos on your work!
helipross.com
Thanks very much for this tool. Is it possible to remove a filter applied with tweenFilterLite?
Cardigan, there isn’t currently a built-in way to automatically kill a filter after tweening it, but I may add that feature in a future version. Right now, though, you can just use an onComplete function to kill your filter(s). To remove all filters from a DisplayObject, just set its filters property to an empty Array in your custom onComplete function, like:
my_mc.filters = [];
Or to kill a specific kind of filter, you could set up an onComplete function like:
function removeFilterType($object:DisplayObject, $filterType:BitmapFilter):void {
var f:Array = $object.filters;
var a:Array = []; //remaining filters
for (var i:int = f.length – 1; i > -1; i–) {
if (!(f[i] is $filterType)) {
a.push(f[i]);
}
}
$object.filters = a;
}
and then in your tween, you’d do something like:
TweenFilterLite.to(my_mc, 1, {blurFilter:{blurX:20}, onComplete:removeFilterType, onCompleteParams:[my_mc, BlurFilter]});
(don’t forget to import the flash.filters.BlurFilter class)
Thank you so much for sharing that, you are truly a hero of the flash dev world… I feel a donation will be imminent…







