blob: 09d32cc5ecd59eb6585037f954454c970057965f [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<s:Module 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:AnimateTransform id="bounceEffect"
target="{myImage}">
<s:motionPaths>
<s:MotionPath property="translationX" >
<s:keyframes>
<s:Keyframe time="250" value="20"/>
<s:Keyframe time="550" value="80"/>
<s:Keyframe time="850" value="120"/>
<s:Keyframe time="1150" value="160"/>
<s:Keyframe time="1450" value="200"/>
<s:Keyframe time="1750" value="240"/>
<s:Keyframe time="2050" value="160"/>
<s:Keyframe time="2350" value="120"/>
<s:Keyframe time="2650" value="80"/>
<s:Keyframe time="2950" value="20"/>
</s:keyframes>
</s:MotionPath>
<s:MotionPath property="translationY" >
<s:keyframes>
<s:Keyframe time="250" value="160"/>
<s:Keyframe time="550" value="60"/>
<s:Keyframe time="850" value="160"/>
<s:Keyframe time="1150" value="60"/>
<s:Keyframe time="1450" value="160"/>
<s:Keyframe time="1750" value="60"/>
<s:Keyframe time="2050" value="160"/>
<s:Keyframe time="2350" value="60"/>
<s:Keyframe time="2650" value="160"/>
<s:Keyframe time="2950" value="60"/>
</s:keyframes>
</s:MotionPath>
</s:motionPaths>
</s:AnimateTransform>
</fx:Declarations>
<s:Panel title="AnimateTransform Effect Sample (Bounce)" width="100%" height="100%">
<s:layout>
<s:HorizontalLayout paddingLeft="10" paddingRight="10" paddingTop="10" paddingBottom="10" />
</s:layout>
<s:Label text="Click the Apache Flex logo to bounce it!" />
<s:Label width="250" verticalAlign="justify"
text="Unlike the Animate class, which you can use to animate any target property, the AnimateTransform effect only supports the animation of certain properties on the target. To use keyframes and motion paths with the AnimateTransform effect, use the MotionPath class to specify keyframes for one or more of the following properties of the AnimateTransform class:
movement (translationX, translationY, and translationZ), rotation (rotationX, rotationY, and rotationZ), scale (scaleX, scaleY, and scaleZ)."/>
</s:Panel>
<mx:Image x="20" y="60" id="myImage"
source="@Embed(source='assets/ApacheFlexIcon.png')"
click="bounceEffect.end();bounceEffect.play()"/>
</s:Module>