| 包 | spark.effects.easing |
| 类 | public class Linear |
| 继承 | Linear Object |
| 实现 | IEaser |
| 语言版本: | ActionScript 3.0 |
| 产品版本: | Flex 4 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
easeInFraction 属性指定的时期内加速,它接着在下一个阶段中使用匀速(线性)运动,最后在由 easeOutFraction 属性指定的时期内减速,直到结束。
会计算这三个阶段的缓动值,以使恒定加速、线性运动和恒定减速的行为全部发生在动画的指定持续时间内。
通过将 easeInFraction 和 easeOutFraction 设置为 0.0 可以实现严格的线性运动。请注意,如果加速或减速不是 0.0,则在中间阶段的运动就不会是与纯线性运动相同的速度。中间阶段包括匀速运动,但运动的速度是由与整个动画相关的阶段的大小确定的。
隐藏 MXML 语法The <s:Linear> tag
inherits all of the tag attributes of its of its superclass,
and adds the following tag attributes:
<s:Linear
id="ID"
easeInFraction="0"
easeOutFraction="0"
/>
| 属性 | 由以下参数定义 | ||
|---|---|---|---|
![]() | constructor : Object
对类对象或给定对象实例的构造函数的引用。 | Object | |
| easeInFraction : Number
动画在加速上花费的部分,在 0.0 和 1.0 之间。 | Linear | ||
| easeOutFraction : Number
动画在减速上将花费的百分比,在 0.0 和 1.0 之间。 | Linear | ||
| 方法 | 由以下参数定义 | ||
|---|---|---|---|
构造函数。 | Linear | ||
基于 easeInFraction 和 easeOutFraction 属性计算缓动部分值。 | Linear | ||
![]() |
表示对象是否已经定义了指定的属性。 | Object | |
![]() |
表示 Object 类的实例是否在指定为参数的对象的原型链中。 | Object | |
![]() |
表示指定的属性是否存在、是否可枚举。 | Object | |
![]() |
设置循环操作动态属性的可用性。 | Object | |
![]() |
返回此对象的字符串表示形式,其格式设置遵守区域设置特定的约定。 | Object | |
![]() |
返回指定对象的字符串表示形式。 | Object | |
![]() |
返回指定对象的原始值。 | Object | |
easeInFraction | 属性 |
easeInFraction:Number| 语言版本: | ActionScript 3.0 |
| 产品版本: | Flex 4 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
动画在加速上花费的部分,在 0.0 和 1.0 之间。easeOutFraction 属性和 easeInFraction 属性的值必须满足等式 easeOutFraction + easeInFraction <= 1,其中所有剩余时间都是在线性运动阶段花费的。
默认值为 0。
实现
public function get easeInFraction():Number public function set easeInFraction(value:Number):voideaseOutFraction | 属性 |
easeOutFraction:Number| 语言版本: | ActionScript 3.0 |
| 产品版本: | Flex 4 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
动画在减速上将花费的百分比,在 0.0 和 1.0 之间。easeOutFraction 属性和 easeInFraction 属性的值必须满足等式 easeOutFraction + easeInFraction <= 1,其中所有剩余时间都是在线性运动阶段花费的。
默认值为 0。
实现
public function get easeOutFraction():Number public function set easeOutFraction(value:Number):voidLinear | () | 构造函数 |
ease | () | 方法 |
public function ease(fraction:Number):Number| 语言版本: | ActionScript 3.0 |
| 产品版本: | Flex 4 |
| 运行时版本: | Flash Player 10, AIR 1.5 |
基于 easeInFraction 和 easeOutFraction 属性计算缓动部分值。如果 fraction 小于 easeInFraction,则它会基于加速到线性运动阶段来计算值。如果 fraction 大于 easeInFraction 且小于 (1-easeOutFraction),则它会基于缓入阶段和缓出阶段之间的线性运动阶段计算值。否则,它会基于在线性运动阶段和 0.0 之间的恒定减速计算值。
参数
fraction:Number — 动画的已过去部分,在 0.0 和 1.0 之间。
|
Number — 动画的缓动部分。
|
<?xml version="1.0"?>
<!-- Simple example to demonstrate the s:Linear class. -->
<s:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Declarations>
<s:Linear id="linearEasing"
easeInFraction="0.3"/>
<s:Elastic id="elasticEasing"/>
<s:Move id="moveRight"
target="{myImage}"
xBy="500"
duration="2000"
easer="{elasticEasing}"/>
<s:Move id="moveLeft"
target="{myImage}"
xBy="-500"
duration="2000"
easer="{linearEasing}"/>
</fx:Declarations>
<s:Panel id="examplePanel"
title="Linear Effect Example"
width="75%" height="75%">
<!-- Directions -->
<s:VGroup id="detailsBox" width="50%" top="5" left="5">
<s:Label width="99%" color="blue"
text="Click the buttons to watch the effect."/>
</s:VGroup>
<mx:Image id="myImage" top="20"
source="@Embed(source='assets/logo.jpg')"/>
<s:Button label="Move Right"
bottom="10" left="5"
click="moveRight.end();moveRight.play();"/>
<s:Button label="Move Left"
bottom="10" left="100"
click="moveLeft.end();moveLeft.play();"/>
</s:Panel>
</s:Application>
Tue Jun 12 2018, 11:04 AM Z
显示 MXML 语法