TweenMax图像渐变动画实现

如果你想给图像加个渐变动画效果,**TweenMax**绝对是个好帮手。通过它,你可以容易地创建平滑的颜色过渡效果。结合**ActionScript3.0**的**ColorTransform**类,这种效果不仅流畅,还能带来不一样的视觉体验。简单来说,**ColorTransform**可以帮你调整显示对象的颜色、透明度、亮度等属性。比如,你可以设置一个物体的颜色,像这样:

var colorTransform:ColorTransform = new ColorTransform(); colorTransform.color = 0x6699FF; movieClip.colorTransform = colorTransform;

,利用**TweenMax**来让它渐变到新的颜色或亮度。像这样:

import com.greensock.TweenMax;
import com.greensock.easing.Linear;
TweenMax.to(movieClip, 1, {colorTransform:{brightness:100}, ease:Linear.easeNone});

这段代码会让你的物体在 1 秒内亮度渐变到 100%。如果想要变换颜色,那也超简单,只要稍微改动:

var initialColor:uint = 0xFF0000; //红色
var finalColor:uint = 0x00FF00; //绿色
var colorTransform:ColorTransform = movieClip.transform.colorTransform;
colorTransform.color = initialColor;
movieClip.transform.colorTransform = colorTransform;
TweenMax.to(movieClip, 2, {colorTransform:{color:finalColor}, ease:Linear.easeInOut});

通过这样组合使用,渐变效果变得简单又强大。而且,除了颜色变化,透明度、缩放、旋转都能一并加入。比如你想同时调整亮度和透明度:

TweenMax.to(movieClip, 1, {colorTransform:{brightness:150, alpha:0.5}, ease:Linear.easeNone});

,**TweenMax**和**ColorTransform**结合使用,能让你在动画效果上做到极致。只要你稍微了解这两个工具,就能创造出炫酷的渐变效果,提升用户体验哦。

folder
通过TweenMax制作图像渐变动画 预估大小:106个文件
file
FlexBlitMask.as 37KB
file
TweenCore.as 22KB
file
TimelineMax.as 46KB
file
AutoFitArea.as 35KB
file
TweenLiteVars.as 63KB
file
TweenMaxVars.as 68KB
file
TweenMax.as 71KB
file
LoaderCore.as 30KB
file
SWFLoader.as 78KB
file
XMLLoader.as 62KB
file
SWFLoaderVars.as 29KB
file
VideoLoaderVars.as 26KB
file
LoaderMax.as 82KB
file
VideoLoader.as 87KB
file
MP3Loader.as 34KB
file
ImageLoader.as 40KB
file
BlitMask.as 35KB
file
TweenLite.as 40KB
file
TimelineLite.as 56KB
file
MotionPath.as 22KB
rar 文件大小:1.03MB