<?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>Blowing Through Lines &#187; Animation</title>
	<atom:link href="http://blowingthroughlines.com/category/flash-as-3/animation/feed/" rel="self" type="application/rss+xml" />
	<link>http://blowingthroughlines.com</link>
	<description>Highly addictive code.</description>
	<lastBuildDate>Tue, 15 Jun 2010 18:14:52 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Automatic Bending Joints in As3 (Simple Bones)</title>
		<link>http://blowingthroughlines.com/2008/02/10/cs3/automatic-bending-joints-in-as3-simple-bones/</link>
		<comments>http://blowingthroughlines.com/2008/02/10/cs3/automatic-bending-joints-in-as3-simple-bones/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 22:32:40 +0000</pubDate>
		<dc:creator>nilloc</dc:creator>
				<category><![CDATA[Animation]]></category>
		<category><![CDATA[CS3]]></category>
		<category><![CDATA[Flash AS 3.0]]></category>

		<guid isPermaLink="false">http://blowingthroughlines.com/2008/02/10/flash-as3/automatic-bending-joints-in-as3-simple-bones/</guid>
		<description><![CDATA[This was part of a Rock&#8217;em Sock&#8217;em Robot game&#038; 8212;for an internal sales project no less! At any rate the budget was good, but the timeline was a little tight, and I was still getting my head around AS3 and the new Flash 9 features.
So I had this idea:
I&#8217;m working with a bunch of designer&#8217;s [...]


No related posts.

Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>This was part of a Rock&#8217;em Sock&#8217;em Robot game&#038; 8212;for an internal sales project no less! At any rate the budget was good, but the timeline was a little tight, and I was still getting my head around AS3 and the new Flash 9 features.</p>
<h3>So I had this idea:</h3>
<p>I&#8217;m working with a bunch of designer&#8217;s who are really good with illustrator, and keyframe animating, but don&#8217;t have the time to animate all the movements (each head, body, upper arm x2 lower arm x2, legs, hands, feet&#8230; well you get the idea). So I needed a way to reduce the number of animations that the designers would be needed for, but also not create too many Tweeners or other hard coded animation solutions. I really needed <a href="http://aralbalkan.com/1072" target="_blank" title="Animated IK (bones) in Diesel (Flash CS4)">bones</a>, but those don&#8217;t seem to be arriving for a while, so the next best thing was automatically animated elbows (and knees). Fortunately for me the illustrator I was working with designed the robot&#8217;s arms and legs with even length upper and lower lengths so I could do some trig and get this:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p35code2'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p352"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p35code2"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> theta:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">acos</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>distance<span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">/</span>limbL<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">*</span><span style="color: #cc66cc;">180</span><span style="color: #66cc66;">/</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span>;
&nbsp;
<span style="color: #0066CC;">this</span>.<span style="color: #006600;">limb</span>.<span style="color: #006600;">rotation</span> =  baseRotation - theta;
<span style="color: #0066CC;">this</span>.<span style="color: #006600;">omoLimb</span>.<span style="color: #006600;">rotation</span> = theta <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">2</span>;</pre></td></tr></table></div>

<p><object type="application/x-shockwave-flash" data="http://blowingthroughlines.com/wp-content/uploads/2008/02/joint_test4.swf" width="500" height="400" class="embedflash"><param name="movie" value="http://blowingthroughlines.com/wp-content/uploads/2008/02/joint_test4.swf" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><small>(Please open the article to see the flash file or player.)</small></object><br />
<span class="caption">Click and drag the hand or foot to see the automagic joint rotation</span></p>
<p><a href='http://blowingthroughlines.com/wp-content/uploads/2008/02/blowingthroughlines_joint.zip' title='AS3 Joint class source'>AS3 Joint class source file</a></p>
<p>Right now it&#8217;s limited to even length bones, but my little brother with the physics and math degrees, says he has a better equation, so as soon as I have time I&#8217;ll update the classes. A public SVN repository is in the works too, stay tuned.</p>


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://blowingthroughlines.com/2008/02/10/cs3/automatic-bending-joints-in-as3-simple-bones/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
