flash缓动类fl.transitions.easing使用

[url]http://www.86ria.com/?p=77[/url]
fl.transitions.easing.*,对应 flex3.x是 mx.effects.easing.*;但是:
fl.transitions.easing.Strong类,在 flex3.x中没有,还有几个类没有,我没有细看。
包中包含可与 fl.transitions 类一起用来创建缓动效果的类。“缓动”是指动画过程中的渐进加速或减速,它会使您的动画看起来更逼真。此包中的类支持多个缓动效果,以加强动画效果。
1.Back类
Back 类可以定义三个缓动函数,以便实现具有 ActionScript 动画的运动。
easeIn() 方法开始时往后运动,然后反向朝目标移动
import fl.transitions.*;
import fl.transsitions.easing.*;
stage.frameRate=31; //获取并设置舞台的帧频。
var box:Sprite=new Sprite();
box.graphics.beginFill(Math.radom()*0xFFFFFF);
box.graphics.drawRect(0,0,100,350);
box.graphics.endFill();
box.x=50;
box.y=10;
addChild(box);
var startValue:Number=box.x;
var finisValue:Number=400;
var duration:Number=3;
var myTween:Tween=new Tween(box,”x”,Back.easeIn,startValue,finishValue,duration,true);

easeInOut()
easeInOut() 方法结合了 easeIn() 和 easeOut() 方法的运动,开始时往后运动,然后反向朝目标移动,稍微冲过目标,再次反向,往后朝目标移动。

import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Back.easeInOut, startValue, finishValue, duration, true);
myTween.looping = true; easeOut()
easeOut() 方法开始运动时是朝目标移动,稍微过冲,再倒转方向回来朝着目标。

import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Back.easeOut, startValue, finishValue, duration, true);
myTween.looping = true;

2.Bounce类
Bounce 类可以定义三个缓动函数,以便实现具有 ActionScript 动画的跳动,类似一个球落向地板又弹起后,几次逐渐减小的回弹运动。
easeIn();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Bounce.easeIn, startValue, finishValue, duration, true);
myTween.looping = true;easeInOut();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Bounce.easeInOut, startValue, finishValue, duration, true);
myTween.looping = true;easeOut();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Bounce.easeOut, startValue, finishValue, duration, true);
myTween.looping = true;

3.Elastic类
Elastic 类可以定义三个缓动函数,以便实现具有 ActionScript 动画的运动,其中的运动由按照指数方式衰减的正弦波来定义。
easeIn();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Elastic.easeIn, startValue, finishValue, duration, true);
myTween.looping = true;easeInOut();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Elastic.easeInOut, startValue, finishValue, duration, true);
myTween.looping = true;easeOut();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Elastic.easeOut, startValue, finishValue, duration, true);
myTween.looping = true;
4.None类
None 类定义缓动函数,以实现 ActionScript 动画的非加速运动。 它的方法都产生同样的效果:持续运动。 提供的 easeIn、easeOut 等各种名称有助于实现多态。 None 类的功能与 fl.motion.easing.Linear 类相同。
easeIn();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, None.easeIn, startValue, finishValue, duration, true);
myTween.looping = true;
easeInOut();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, None.easeInOut, startValue, finishValue, duration, true);
myTween.looping = true;
easeOut();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, None.easeOut, startValue, finishValue, duration, true);
myTween.looping = true;

5.Regular类
Regular 类可以定义三个缓动函数,以便实现具有 ActionScript 动画的加速运动。 Regular 缓动方程的运动加速与 100% 缓动的时间轴补间相同,显著低于 Strong 缓动方程。 Regular 类的功能与 fl.motion.easing.Quadratic 类相同。
easeIn();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Regular.easeIn, startValue, finishValue, duration, true);
myTween.looping = true;
easeInOut();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Regular.easeInOut, startValue, finishValue, duration, true);
myTween.looping = true;
easeOut();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Regular.easeOut, startValue, finishValue, duration, true);
myTween.looping = true;

6.Strong类
Strong 类可以定义三个缓动函数,以便实现具有 ActionScript 动画的运动。 Strong 缓动方程的运动加速大于 Regular 缓动方程。 Strong 类的功能与 fl.motion.easing.Quintic 类相同。

easeIn();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Strong.easeIn, startValue, finishValue, duration, true);
myTween.looping = true;
easeInOut();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Strong.easeInOut, startValue, finishValue, duration, true);
myTween.looping = true;
easeOut();
import fl.transitions.*;
import fl.transitions.easing.*;

stage.frameRate = 31;

var box:Sprite = new Sprite();
box.graphics.beginFill(Math.random() * 0xFFFFFF);
box.graphics.drawRect(0, 0, 100, 350);
box.graphics.endFill();
box.x = 50;
box.y = 10;
addChild(box);

var startValue:Number = box.x;
var finishValue:Number = 400;
var duration:Number = 3;
var myTween:Tween = new Tween(box, “x”, Strong.easeOut, startValue, finishValue, duration, true);
myTween.looping = true;


===========================================
缓动类
Back
在过渡范围外的一端或两端扩展动画一次,以产生从其范围外回拉的效果。
Bounce
在过渡范围的一端或两端内添加弹跳效果。弹跳数与持续时间相关,持续时间越长,弹跳数越多。
Elastic
添加一端或两端超出过渡范围的弹性效果。弹性量不受持续时间影响。
Regular
在一端或两端添加较慢的运动。此功能使您能够添加加速效果、减速效果或这两种效果。
Strong
在一端或两端添加较慢的运动。此效果类似于 Regular 缓动类,但它更明显。
None
添加从开始到结尾无任何减速或加速效果的相同的运动。此过渡也称为线性过渡。

这六种缓动计算类的每一种都有三个缓动方法,它们指明缓动效果应用于动画的哪个部分。此外,None 缓动类还有第四个缓动方法:easeNone。下表中描述了这些缓动方法:方法
easeIn
在过渡的开始提供缓动效果。
easeOut
在过渡的结尾提供缓动效果。
easeInOut
在过渡的开始和结尾提供缓动效果。
easeNone
指明不使用缓动计算。只在 None 缓动类中提供。

begin,一个指示 prop(要补间的目标对象属性)的开始值的数字。动画将开始的值,一般说来就是MC的座标位置。
finish,一个指示 prop(要补间的目标对象属性)的结束值的数字。
duration,一个数字,指示补间动画的时间长度。如果省略,duration 会默认设置成无穷大。就是指动画运行的时间长度。如果想动画运动得比较匀速。建议把帧频设置大点,比如60FPS。
useSeconds,一个布尔值,如果相对于 duration 参数中指定的值为 true,则表示使用秒;如果为 false,则表示使用帧。
文章来自: 闪无忧(www.5uflash.com) 详文参考:http://www.5uflash.com/flashjiaocheng/Flashaschengxu/3412.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值