<?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>Plexipixel Linefeed &#187; math</title>
	<atom:link href="http://plexipixel.com/linefeed/category/math/feed/" rel="self" type="application/rss+xml" />
	<link>http://plexipixel.com/linefeed</link>
	<description>Plexipixel development blog</description>
	<lastBuildDate>Thu, 07 May 2009 20:06:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Just Another Day in the Pants Dungeon</title>
		<link>http://plexipixel.com/linefeed/02/just-another-day-in-the-pants-dungeon/</link>
		<comments>http://plexipixel.com/linefeed/02/just-another-day-in-the-pants-dungeon/#comments</comments>
		<pubDate>Fri, 29 Feb 2008 19:28:25 +0000</pubDate>
		<dc:creator>Joshua</dc:creator>
				<category><![CDATA[math]]></category>
		<category><![CDATA[actionscript tweening]]></category>
		<category><![CDATA[easing]]></category>

		<guid isPermaLink="false">http://www.plexipixel.com/linefeed/?p=6</guid>
		<description><![CDATA[The applications and designs at Plexipixel aren't all just graphically cool, they have serious math behind them.
Even though when we were in middle school we swore a solemn oath that we would never use math when we grew up... we ended up breaking that oath. Our transition effects engine provides custom sinusoidal easing which is [...]]]></description>
			<content:encoded><![CDATA[<p>The applications and designs at Plexipixel aren't all just graphically cool, they have serious math behind them.</p>
<p>Even though when we were in middle school we swore a solemn oath that we would never use math when we grew up... we ended up breaking that oath. Our transition effects engine provides custom sinusoidal easing which is very subtle even at longer durations. We wanted to add more dramatic easing functionality. When we were researching we came across some easing equations by Robert Penner, which he provides as open source under the BSD Liscence on his <a href="http://robertpenner.com/easing">site</a> (http://robertpenner.com/easing).</p>
<p>c = change (displacement value),</p>
<p>t = elapsed time since the beginning of the effect,</p>
<p>b = the beginning value of the property being tweened,</p>
<p>and d = the duration of the effect.</p>
<p>ease in = c * Math.pow(2, 10 * (t/d - 1)) + b;</p>
<p>ease out = c * (-Math.pow(2, -10 * t/d) + 1) + b;</p>
<p>The value they return is a coordinate on the stage where the movie clip should move to. We needed something that would return the amount of change for each interval, instead of a value to move to. This was easily accomplished and can be done like this:<br />
<pre><pre>
var prev:Number = 0;

var startTime:Number = getTimer();

var change:Number = 500;

var dur:Number = 1200;

function easeOut(t:Number, c:Number, d:Number):Number {

return c * (-Math.pow(2, -10 * t/d) + 1);

}

var iv:Number = setInterval(function():Void {

var elapsed:Number = getTimer() - startTime;

if(elapsed &gt;= dur) {

clearInterval(iv);

mc._x += change - prev;

return;

}

var amt:Number = easeOut(elapsed, change, dur);

mc._x += amt - prev;

prev = amt;

}, 30);
</pre></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://plexipixel.com/linefeed/02/just-another-day-in-the-pants-dungeon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
