<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; easingFunction</title>
	<atom:link href="http://blog.flexexamples.com/tag/easingfunction/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using an easing function with the AnimateProperties class in Flex and Flash Player 10</title>
		<link>http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/</link>
		<comments>http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 13:47:03 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[AnimateProperties]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[duration]]></category>
		<category><![CDATA[easingFunction]]></category>
		<category><![CDATA[Gumbo]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/</guid>
		<description><![CDATA[<p>The following example shows how you can apply an easing function to a property animation in Flex with the beta Gumbo SDK and Flash Player 10 by setting the easingFunction property on the AnimateProperties object instance.</p> <p>Full code after the jump.</p> <p></p> <p class="alert">To use the following code, you must have Flash Player 10 and [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can apply an easing function to a property animation in Flex with the beta Gumbo SDK and Flash Player 10 by setting the <code>easingFunction</code> property on the AnimateProperties object instance.</p>
<p>Full code after the jump.</p>
<p><span id="more-742"></span></p>
<p class="alert">To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see <a href="http://blog.flexexamples.com/2008/08/02/using-the-beta-gumbo-sdk-in-flex-builder-3/">&#8220;Using the beta Gumbo SDK in Flex Builder 3&#8243;</a>.</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/AnimateProperties_easingFunction_test/bin/srcview/source/main1.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/ --&gt;
&lt;Application name="AnimateProperties_easingFunction_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        xmlns:mx="library:adobe/flex/halo"
        layout="flex.layout.BasicLayout"&gt;

    &lt;Declarations&gt;
        &lt;AnimateProperties id="animateProps"
                easingFunction="Elastic.easeOut"
                duration="4000"&gt;
            &lt;propertyValuesList&gt;
                &lt;PropertyValuesHolder property="rotationY"
                        values="[0, 360]" /&gt;
            &lt;/propertyValuesList&gt;
        &lt;/AnimateProperties&gt;
    &lt;/Declarations&gt;

    &lt;Script&gt;
        import mx.effects.easing.*;

        private function animateRotationY():void {
            animateProps.stop();
            animateProps.play([img]);
        }
    &lt;/Script&gt;

    &lt;Button label="Rotate y-axis"
            top="10"
            left="10"
            click="animateRotationY();" /&gt;

    &lt;mx:Image id="img"
            source="@Embed('Fx.png')"
            width="100"
            height="100"
            horizontalCenter="0"
            verticalCenter="0" /&gt;

&lt;/Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/AnimateProperties_easingFunction_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/AnimateProperties_easingFunction_test/bin/main.html" width="100%" height="200"></iframe></p>
<p>You can also set the <code>easingFunction</code> property in ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/AnimateProperties_easingFunction_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/ --&gt;
&lt;Application name="AnimateProperties_easingFunction_test"
        xmlns="http://ns.adobe.com/mxml/2009"
        xmlns:mx="library:adobe/flex/halo"
        layout="flex.layout.BasicLayout"
        initialize="init();"&gt;

    &lt;Script&gt;
        import flex.effects.AnimateProperties;
        import flex.effects.PropertyValuesHolder;
        import mx.effects.easing.*;

        private var animateProps:AnimateProperties;

        private function init():void {
            var rotYProp:PropertyValuesHolder;
            rotYProp = new PropertyValuesHolder("rotationY", [0, 360]);
            animateProps = new AnimateProperties();
            animateProps.easingFunction = Elastic.easeOut;
            animateProps.duration = 4000; // ms
            animateProps.propertyValuesList = [rotYProp];
        }

        private function animateRotationY():void {
            animateProps.stop();
            animateProps.play([img]);
        }
    &lt;/Script&gt;

    &lt;Button label="Rotate y-axis"
            top="10"
            left="10"
            click="animateRotationY();" /&gt;

    &lt;mx:Image id="img"
            source="@Embed('Fx.png')"
            width="100"
            height="100"
            horizontalCenter="0"
            verticalCenter="0" /&gt;

&lt;/Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Using an easing function with the AnimateProperties class in Flex and Flash Player 10 on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/',contentID: 'post-742',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'duration,easingFunction,Gumbo',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/08/12/using-an-easing-function-with-the-animateproperties-class-in-flex-and-flash-player-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Animating a Flex PieChart control&#8217;s rotation when a user clicks on an item</title>
		<link>http://blog.flexexamples.com/2007/11/22/animating-a-flex-piechart-controls-rotation-when-a-user-clicks-on-an-item/</link>
		<comments>http://blog.flexexamples.com/2007/11/22/animating-a-flex-piechart-controls-rotation-when-a-user-clicks-on-an-item/#comments</comments>
		<pubDate>Thu, 22 Nov 2007 08:12:46 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[Charting]]></category>
		<category><![CDATA[PieChart]]></category>
		<category><![CDATA[SeriesInterpolate]]></category>
		<category><![CDATA[easingFunction]]></category>
		<category><![CDATA[perWedgeExplodeRadius]]></category>
		<category><![CDATA[startAngle]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/11/22/animating-a-flex-piechart-controls-rotation-when-a-user-clicks-on-an-item/</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2007/11/07/rotating-a-flex-piechart-control-when-a-user-clicks-on-an-item/">&#8220;Rotating a Flex PieChart control when a user clicks on an item&#8221;</a>, we looked at changing a PieChart&#8217;s rotation when the user clicked on a pie wedge. In the following example, we look at how to add a nice animation effect with some easing to make the effect a bit [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2007/11/07/rotating-a-flex-piechart-control-when-a-user-clicks-on-an-item/">&#8220;Rotating a Flex PieChart control when a user clicks on an item&#8221;</a>, we looked at changing a PieChart&#8217;s rotation when the user clicked on a pie wedge. In the following example, we look at how to add a nice animation effect with some easing to make the effect a bit more smooth.</p>
<p>Full code after the jump.</p>
<p><span id="more-324"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_showDataEffect_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/11/22/animating-a-flex-piechart-controls-rotation-when-a-user-clicks-on-an-item/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.effects.easing.*;
            import mx.charts.series.items.PieSeriesItem;
            import mx.charts.events.ChartItemEvent;

            private function pieChart_itemClick(evt:ChartItemEvent):void {
                var item:PieSeriesItem = evt.hitData.chartItem as PieSeriesItem;
                var degrees:Number = radiansToDegrees(item.startAngle);
                var arr:Array = [];
                if (checkBox.selected) {
                    arr[item.index] = 0.2;
                }
                pieSeries.perWedgeExplodeRadius = arr;
                pieSeries.startAngle -= degrees;

                dp.refresh();
            }

            private function radiansToDegrees(radians:Number):Number {
                return radians * (180 / Math.PI);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:XMLListCollection id="dp"&gt;
        &lt;mx:source&gt;
            &lt;mx:XMLList&gt;
                &lt;product label="Product 1" data="3" /&gt;
                &lt;product label="Product 2" data="1" /&gt;
                &lt;product label="Product 3" data="4" /&gt;
                &lt;product label="Product 4" data="1" /&gt;
                &lt;product label="Product 5" data="5" /&gt;
                &lt;product label="Product 6" data="9" /&gt;
            &lt;/mx:XMLList&gt;
        &lt;/mx:source&gt;
    &lt;/mx:XMLListCollection&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:CheckBox id="checkBox"
                label="Use perWedgeExplodeRadius:"
                labelPlacement="left"
                selected="true" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:PieChart id="pieChart"
            dataProvider="{dp}"
            showDataTips="true"
            itemClick="pieChart_itemClick(event);"
            height="100%"
            width="100%"&gt;
        &lt;mx:series&gt;
            &lt;mx:PieSeries id="pieSeries"
                    field="@data"
                    nameField="@label"&gt;
                &lt;mx:showDataEffect&gt;
                    &lt;mx:SeriesInterpolate duration="1500"
                            easingFunction="{Elastic.easeOut}" /&gt;
                &lt;/mx:showDataEffect&gt;
                &lt;mx:filters&gt;
                    &lt;mx:DropShadowFilter /&gt;
                &lt;/mx:filters&gt;
            &lt;/mx:PieSeries&gt;
        &lt;/mx:series&gt;
    &lt;/mx:PieChart&gt;

    &lt;mx:Legend dataProvider="{pieChart}" direction="horizontal" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/PieSeries_showDataEffect_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/PieSeries_showDataEffect_test/bin/main.html" width="100%" height="500"></iframe></p>
<p>But remember kids, just because you can add easing, doesn&#8217;t mean you always should! ;)</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Animating a Flex PieChart control\&#039;s rotation when a user clicks on an item on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/11/22/animating-a-flex-piechart-controls-rotation-when-a-user-clicks-on-an-item/',contentID: 'post-324',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'easingFunction,perWedgeExplodeRadius,startAngle',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/11/22/animating-a-flex-piechart-controls-rotation-when-a-user-clicks-on-an-item/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>

