简体   繁体   中英

tinting a MC with tweener

I would like to tint a movieclip with the tweener class.

This is how I tint the mc without the tween:

var c:Color=new Color();

c.setTint(0xff0000, 0.8); clouds.transform.colorTransform=c;

it works but I would like to give it a smooth transition that's why I would use tweener.

Anyone have an idea?

Tweener has a bunch of special properties you can tween (one of them being color). See the documentation here: http://hosted.zeh.com.br/tweener/docs/en-us/

You'll need to import/initialize the class before you can use it like so:

import caurina.transitions.properties.ColorShortcuts;
ColorShortcuts.init();

then you'll want to use the _color property like so:

Tweener.addTween(myDisplayObject, {_color: 0xff0000, alpha: 0.8, time: 2});

Ive found Tweener to not work properly with colour tweens in AS3. I use TweenLite http://blog.greensock.com/tweenlite/ :

import com.greensock.*;
import com.greensock.plugins.*;
TweenPlugin.activate([TintPlugin]);
TweenLite.to(mc, 0.8, {tint:0xff0000});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM