<?xml version="1.0"?>










<rss version="2.0">
  <channel>
    <title><![CDATA[Super Genius]]></title>
    <link>http://super-genius.webs.com/genius1.htm</link>
    <description><![CDATA[The # 2 pencil it's # 1]]></description>
    <generator>Freewebs</generator>

    <item>
      <title><![CDATA[Cool flash sites]]></title>
      <link>http://super-genius.webs.com/genius1.htm?blogentryid=3181347</link>
      <description><![CDATA[<P class=menu-links><A class=ext href="http://www.bestflashanimationsite.com/cgi-bin/jump.cgi?ID=9328" target=_blank rel=external><IMG class=image-preview height=60 alt="Take This Dance" src="http://www.bestflashanimationsite.com/v2/images/archive/9328.gif" width=150 border=0></A>&nbsp; <A class=ext href="http://www.bestflashanimationsite.com/cgi-bin/jump.cgi?ID=9328" target=_blank rel=external>Take This Dance</A> <IMG height=17 alt="Flash player 9 compatible" src="http://www.bestflashanimationsite.com/v2/images/flashversion9.gif" width=20> <BR>Karlsruhe, Germany<BR><SPAN>(Hits: 13226 &#124; Votes: <STRONG>181</STRONG>)</SPAN> </P>
<DIV id=l9323>
<P class=menu-links><A class=ext href="http://www.bestflashanimationsite.com/cgi-bin/jump.cgi?ID=9323" target=_blank rel=external><IMG class=image-preview height=60 alt="Saizen Media - Night Wish" src="http://www.bestflashanimationsite.com/v2/images/archive/9323.gif" width=150 border=0></A>&nbsp; <A class=ext href="http://www.bestflashanimationsite.com/cgi-bin/jump.cgi?ID=9323" target=_blank rel=external>Saizen Media - Night Wish</A> <IMG height=17 alt="Flash player 8 compatible" src="http://www.bestflashanimationsite.com/v2/images/flashversion8.gif" width=20> <BR>Italy and Russia<BR><SPAN>(Hits: 17500 &#124; Votes: <STRONG>97</STRONG>)</SPAN> </P></DIV>
<DIV id=l9325>
<P class=menu-links><A class=ext href="http://www.bestflashanimationsite.com/cgi-bin/jump.cgi?ID=9325" target=_blank rel=external><IMG class=image-preview height=60 alt="Bogdan Pavel" src="http://www.bestflashanimationsite.com/v2/images/archive/9325.gif" width=150 border=0></A>&nbsp;<A class=ext href="http://www.bestflashanimationsite.com/cgi-bin/jump.cgi?ID=9325" target=_blank rel=external>Bogdan Pavel</A> <IMG height=17 alt="Flash player 8 compatible" src="http://www.bestflashanimationsite.com/v2/images/flashversion8.gif" width=20> <BR>Sibiu, Romania<BR><SPAN>(Hits: 12511 &#124; Votes: <STRONG>82</STRONG>)</SPAN> </P></DIV>
<DIV id=l9327>
<P class=menu-links><A class=ext href="http://www.bestflashanimationsite.com/cgi-bin/jump.cgi?ID=9327" target=_blank rel=external><IMG class=image-preview height=60 alt="Casino Riviera" src="http://www.bestflashanimationsite.com/v2/images/archive/9327.gif" width=150 border=0></A>&nbsp; <A class=ext href="http://www.bestflashanimationsite.com/cgi-bin/jump.cgi?ID=9327" target=_blank rel=external>Casino Riviera</A> <IMG height=17 alt="Flash player 8 compatible" src="http://www.bestflashanimationsite.com/v2/images/flashversion8.gif" width=20> <BR>Breznica, Slovenia<BR><SPAN>(Hits: 8491 &#124; Votes: <STRONG>19</STRONG>)</SPAN> </P></DIV>
<DIV id=l9324>
<P class=menu-links><A class=ext href="http://www.bestflashanimationsite.com/cgi-bin/jump.cgi?ID=9324" target=_blank rel=external><IMG class=image-preview height=60 alt=Guldsits src="http://www.bestflashanimationsite.com/v2/images/archive/9324.gif" width=150 border=0></A>&nbsp;<A class=ext href="http://www.bestflashanimationsite.com/cgi-bin/jump.cgi?ID=9324" target=_blank rel=external>Guldsits</A> <IMG height=17 alt="Flash player 8 compatible" src="http://www.bestflashanimationsite.com/v2/images/flashversion8.gif" width=20> <BR>Stockholm, Sweden<BR><SPAN>(Hits: 7597 &#124; Votes: <STRONG>13</STRONG>)</SPAN> </P></DIV>
<DIV id=l9326>
<P class=menu-links><A class=ext href="http://www.bestflashanimationsite.com/cgi-bin/jump.cgi?ID=9326" target=_blank rel=external><IMG class=image-preview height=60 alt="Alex Prager" src="http://www.bestflashanimationsite.com/v2/images/archive/9326.gif" width=150 border=0></A>&nbsp; <A class=ext href="http://www.bestflashanimationsite.com/cgi-bin/jump.cgi?ID=9326" target=_blank rel=external>Alex Prager</A> <IMG height=17 alt="Flash player 9 compatible" src="http://www.bestflashanimationsite.com/v2/images/flashversion9.gif" width=20> <BR>Los Angeles, CA USA<BR><SPAN>(Hits: 9818 &#124; Votes: <STRONG>10</STRONG>)</SPAN> </P>
<P>10. &#145;<A href="http://www.oddtodd.com/index2.html" target=blank><FONT color=#253487>Laid Off: A Day in the Life</FONT></A>&#145; by Odd Todd<BR>9. &#145;<A href="http://www.squetch.com/tism.html" target=blank><FONT color=#253487>Everyone Else Has Had More Sex Than Me</FONT></A>&#145; by Bernard Derriman<BR>8. &#145;<A href="http://www.icebox.com/index.php?id=episode&amp;show_id=s10&amp;episode_id=e1&amp;PHPSESSID=fd592c77bdbeb5644889248dcdd0aa7c" target=blank><FONT color=#253487>Urine Trouble, Part 1</FONT></A>&#145; Mr. Wong by Pam Brady &amp; Kyle McCulloch<BR>7. &#145;<A href="http://www.homestarrunner.com/sbemail58.html" target=blank><FONT color=#253487>Dragon</FONT></A>&#145; Strong Bad Email #58 by Mike and Matt Chapman<BR>6. &#145;<A href="http://coldhardflash.com/video/06-endofworld.swf" target=blank><FONT color=#253487>The End of the World</FONT></A>&#145; by Jason Windsor<BR>5. &#145;<A href="http://www.campchaos.com/blog-archives/2006/05/napster_bad.html" target=blank><FONT color=#253487>Napster Bad!</FONT></A>&#145; by Bob Cesca<BR>4. &#145;<A href="http://www.biteycastle.com/prowlies.html" target=blank><FONT color=#253487>Prowlies at the River</FONT></A>&#145; by Adam Phillips<BR>3. &#145;<A href="http://www.coldhardflash.com/video/george-liquor-Episode1.swf" target=blank><FONT color=#253487>Babysitting the Idiot</FONT></A>&#145; The Goddamn George Liquor Program by John K<BR>2. &#145;<A href="http://mondo.happytreefriends.com/watch_episodes/flash/play_instream.asp?episode=spin" target=blank><FONT color=#253487>Spin Fun Knowing Ya</FONT></A>&#145; Happy Tree Friends by Kenn Navarro &amp; Rhode Montijo<BR>1. &#145;<A href="http://www.jibjab.com/JokeBox/JokeBox_JJOrig.aspx?movieid=65" target=blank><FONT color=#253487>This Land</FONT></A>&#145; by Gregg &amp; Evan Spiridellis</P>
<P>Quite a list, eh? And what about the nominees? Well, they had to meet a certain set of criteria in order to make the list:</P>
<UL>
<LI>A majority of the short had to have been made using Flash 
<LI>The short had to have premiered and received most of its acclaim on the web 
<LI>It had to be linear (The interactive &#145;Frog in a Blender&#146; by Joe Cartoon is out) </LI></UL></DIV>]]></description>
      <comments>http://super-genius.webs.com/genius1.htm?blogentryid=3181347#topBox</comments>
      <guid isPermaLink="true">http://super-genius.webs.com/genius1.htm?blogentryid=3181347</guid>
      <pubDate>Mon, 24 Mar 2008 18:19:00 -0100</pubDate>
    </item>

    <item>
      <title><![CDATA[Flash and Physics ]]></title>
      <link>http://super-genius.webs.com/genius1.htm?blogentryid=3181290</link>
      <description><![CDATA[<P>Flash is well-known for producing spiffy animations. Not as well-known is how to use it for demonstrations in the sciences using proper mathematical equations to control the motions. Using proper Physics equations for animations is also useful for realistic games. This small document is a tutorial in exploiting the capability of using equations to control animations. I assume that you already know at least a little about using Flash, and have at least a rudimentary knowledge of ActionScript.</P>
<P>We will create 5 different animations below. I have made each of them as simple as possible, so we don't get mired in unimportant details.</P>
<P>When this document was written, the current Flash program was <EM>MX 2004</EM>. Some discussion of defaults below assumes this version. </P>
<H2 align=left><A name=undamped></A>The Undamped Harmonic Oscillator </H2>
<P align=left>We will use a harmonic oscillator, such as a mass oscillating on a spring, as our example. The mathematics is fairly simple. For the ideal case of an oscillator with no dissipative forces, the motion is given by:</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD>&nbsp;</TD>
<TD>
<DIV align=center><IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/index_1.gif" width=200></DIV></TD>
<TD>
<DIV align=right>(1)</DIV></TD></TR></TBODY></TABLE><STRONG>A</STRONG> is the maximum amplitude of the oscillation. <IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/omega0.gif" width=24 align=absBottom> (pronounced <EM>omega naught) </EM>is the "natural" angular frequency of oscillation, and depends on the mass and the particular spring. <STRONG>t</STRONG> is the time. <IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/phi.gif" width=15 align=absBottom> (pronounced <EM>phi) </EM>is called the "phase angle" of the oscillation, and essentially depends on what moment in time we choose to call zero. 
<P align=left>In this document we will be clever and choose the phase angle to be zero. Thus, we will do an animation that obeys the following equation:</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD width="5%">&nbsp;</TD>
<TD width="85%">
<DIV align=center><IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Eqn2.gif" width=159></DIV></TD>
<TD width="10%">
<DIV align=right>(2)</DIV></TD></TR></TBODY></TABLE>
<P>Although we call the position <STRONG>y</STRONG>, below we will find it convenient to have the motion occur in the horizontal direction. In ActionScript-speak, this is named <EM>_x</EM>.</P>
<P>Above the angular frequency is measured in radians/second, which when multiplied by the time gives radians. Flash trig functions also measure angles in radians. Usually humans think about such motion in terms of the frequency, measured in Hz, or the period <STRONG>T</STRONG> of oscillation. The period is related to the angular frequency by:</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD width="6%">&nbsp;</TD>
<TD width="84%">
<DIV align=center><IMG height=50 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Eqn3.gif" width=87></DIV></TD>
<TD width="10%">
<DIV align=right>(3)</DIV></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD>To the right we show a plot of Eqn. 2 for a value of the period equal to 2 seconds. </TD>
<TD><IMG height=266 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/SinPlot.gif" width=432></TD></TR></TBODY></TABLE>
<H2>Faking It</H2>
<P>Although this tutorial is primarily about using ActionScript to properly control an animation, sometimes it is possible to do pretty well by faking it. That is the topic of this section.</P>
<P>Our undamped oscillator will have a period of 2.0 seconds. This corresponds to an angular frequency equal to <IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/pi.gif" width=16 align=absBottom>(pronounced <EM>pi</EM>), which is irrational. </P>
<P>I like to write to the minimum level of the Flash player possible. This minimises the number of people who have to update their player to view the animation. For this project, that means I would change the <EM>Settings ...</EM> to <EM>Flash Player 5</EM>. Perhaps for you this is not important, and you can leave the settings to the default (Flash Player 7, ActionScript 2) if you prefer.</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD>
<P>Open a new Flash document and place some object, such as a circle, on the stage. Insert key frames at frames 7, 13, 19 and 25. A portion of your Flash window should now look similar to this:</P></TD>
<TD><IMG height=475 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/FakeSS1.gif" width=500></TD></TR></TBODY></TABLE>
<P>Above we said that we wanted a period of 2.0 seconds, and at the default Flash frame rate of 12.0 fps this corresponds to 24 frames. You may be wondering why we set the last key frame at frame 25 instead of 24. The reason is that the first frame is 1, not 0. Thus between the first and last key frame is 25 -1 = 24 frames. Similarly, from any key frame to the next is exactly 6 frames, which is 1/4 of the period. </P>
<P>We will have the object in key frames 1, 13 and 25 be the equilibrium position, and will not change the position of the object in these frames.</P>
<P>Choose the key frame at frame 7 and move the object some distance to the right. Choose the key frame at frame 19 and move the object the same distance to the left.</P>
<P>Now, put a <EM>tween</EM> between each pair of key frames. My object is just a circle, so I used a <EM>Shape</EM> tween. The result looks like this:</P>
<P>
<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 height=100 width=550 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="_cx" VALUE="14552"><PARAM NAME="_cy" VALUE="2646"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="Flash/FakingIt1.swf"><PARAM NAME="Src" VALUE="Flash/FakingIt1.swf"><PARAM NAME="WMode" VALUE="Window"><PARAM NAME="Play" VALUE="-1"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE=""><PARAM NAME="Scale" VALUE="ShowAll"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE=""><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="false">
            <embed src="Flash/FakingIt1.swf" width="550" height="100" 
quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" 
type="application/x-shockwave-flash"></embed>  </OBJECT></P>
<P>This is not good. It doesn't look very harmonic, and there is a "bump" when it moves through the center position from the left to the right.</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD>To make it look more realistic, we will use <EM>Eases</EM> on the tweens. The Ease control is just under the <EM>Tween</EM> one in the Properties panel. After selecting a tween, the figure to the right shows setting an "Ease Out 100." </TD>
<TD><IMG height=128 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/SimpleTween.gif" width=400></TD></TR></TBODY></TABLE>
<P>Set the following Eases:</P>
<P><STRONG>Between Frames 1 &amp; 7</STRONG>: Ease Out 100.<BR><STRONG>Between Frames 7 and 13</STRONG>: Ease In 100.<BR><STRONG>Between Frames 13 and 19</STRONG>: Ease Out 100.<BR><STRONG>Between Frames 19 and 25</STRONG>: Ease In 100.</P>
<P>Finally, the "bump" is because both key frames 1 and 25 have the object in the same position. To fix:</P>
<OL>
<LI>Insert a key frame at frame 24. Be sure to do this only after all the tweens have been made and eased. 
<LI>In frame 25, remove the contents and remove the frame. Now the final frame of the animation is 24. </LI></OL>
<P>The result looks like this:</P>
<P>
<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 height=100 width=550 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="_cx" VALUE="14552"><PARAM NAME="_cy" VALUE="2646"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="Flash/FakingItFinal.swf"><PARAM NAME="Src" VALUE="Flash/FakingItFinal.swf"><PARAM NAME="WMode" VALUE="Window"><PARAM NAME="Play" VALUE="-1"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE=""><PARAM NAME="Scale" VALUE="ShowAll"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE=""><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="false">
            <embed src="Flash/FakingItFinal.swf" quality="high" 
pluginspage="http://www.macromedia.com/go/getflashplayer" 
type="application/x-shockwave-flash" width="550" height="100"></embed>  
</OBJECT></P>
<P>This looks pretty good, and may in fact be good enough for your purposes. </P>
<P>You may want to take a moment and convince yourself that the period of this last animation is 2.00 seconds. In fact the first animation above had an a period equal to 25/12 = 2.083 seconds. In general I would have preferred for Flash to begin counting the frames from 0, not 1. </P>
<H2><A name=doingit></A>Doing It With ActionScript</H2>
<P>Now we will do a similar animation to above using the ActionScript language that is built in to Flash. As before the oscillator will have a period of 2.00 sec. You will see that this animation has only one frame.</P>
<P>The ActionScript language has similar syntax to C, JavaScript, etc. so if you know one of those languages you already know where to put the curly braces, semi-colons etc. You will also see that we use the math functions and constants of Flash; these begin with the string <EM>Math<STRONG>.</STRONG>,</EM> such as <EM>Math.sin()</EM>. </P>
<P>Create a new Flash document. I changed the <EM>Settings</EM> to Flash Player 6, and ActionScript 1, but you can use the defaults if you prefer.</P>
<P>Create an object, such as a circle, on the stage and make sure it is selected. To control the object with ActionScript you need to convert it to a <EM>Movie Clip</EM>. <EM>Flash MX</EM> and <EM>Flash MX 2004</EM> have slightly different ways to do this. For <EM>Flash MX</EM> choose <STRONG>Insert &gt; Convert to Symbol</STRONG>. For <EM>Flash MX 2004</EM> choose <STRONG>Modify &gt; Convert to Symbol</STRONG>. For both versions F8 will have the same effect, or you can right-click on the object to access the <EM>Convert to Symbol</EM> command. </P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD>In the window that appears click on <EM>Movie Clip</EM> and name it <EM>sphere_mc</EM>, as shown. </TD>
<TD>
<DIV align=center><IMG height=445 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/SimpleMC.gif" width=414></DIV></TD></TR>
<TR>
<TD colSpan=2>
<HR>
</TD></TR>
<TR>
<TD width="79%">With the new movie clip selected, set the instance name to <EM>sphere</EM> in the Properties panel, as shown. </TD>
<TD width="21%"><IMG height=204 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/SimpleProperties.gif" width=450></TD></TR></TBODY></TABLE>
<HR>

<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD width="56%">
<P>It is a good idea to leave your movie clip in its own layer. Create a new layer and name it <EM>actions</EM> as shown.</P>
<P>With the <EM>actions</EM> layer still selected, open the <EM>Actions</EM> panel at the bottom of the main window. </P></TD>
<TD width="44%"><IMG height=396 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/SimpleLayers.gif" width=450></TD></TR>
<TR>
<TD colSpan=2>
<HR>
</TD></TR>
<TR>
<TD>
<P>Enter the code shown to the right into the Actions panel.</P>
<P>That is it. The result is shown below. </P></TD>
<TD><IMG height=340 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/SimpleActions.gif" width=450></TD></TR></TBODY></TABLE>
<P>
<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 height=100 width=550 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="_cx" VALUE="14552"><PARAM NAME="_cy" VALUE="2646"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="Flash/Simple.swf"><PARAM NAME="Src" VALUE="Flash/Simple.swf"><PARAM NAME="WMode" VALUE="Window"><PARAM NAME="Play" VALUE="0"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE=""><PARAM NAME="Scale" VALUE="ShowAll"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE=""><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="false">
            <embed src="Flash/Simple.swf" quality="high" 
pluginspage="http://www.macromedia.com/go/getflashplayer" 
type="application/x-shockwave-flash" width="550" height="100"></embed>  
</OBJECT></P>
<P>Here are a few comments about the code:</P>
<UL>
<LI>Technically you do not need to declare variables with a <EM>var</EM> statement, but it is a good idea to do so and comment what they are, as shown. 
<LI>I compute the angular frequency <EM>w</EM> from the period <EM>T</EM>, using Equation 3 from the <STRONG>Undamped Harmonic Oscillator</STRONG> section above. 
<LI>The block of code:<BR><BR><SPAN class=style1><FONT face="Courier New">onEnterFrame = function() &#123;<BR>...<BR>&#125;<BR><BR></FONT><SPAN class=style2><FONT face=Arial>is a Flash construct. The code between the curly braces is executed every time the frame is entered.</FONT></SPAN><FONT face="Courier New"> </FONT></SPAN>
<LI>Line 7 moves the object. The name <EM>sphere</EM> is the name of the instance of the movie clip that we assigned earlier. 
<LI>I increment the time <EM>after</EM> the position is updated, so the initial position of the sphere is for <EM>t</EM> = 0. 
<LI>The time increment is one over the frames per second of the animation, so the unit of <EM>t</EM> is seconds. The form of Line 8 is a shorthand for:<BR><BR><SPAN class=style1><FONT face="Courier New">t = t + 1/12;<BR><BR></FONT></SPAN>
<LI>Except for the time, the other variables are not required. You could just put the raw numbers in Line 7. When we animate the damped oscillator you will see one example of why this is usually not a good idea. </LI></UL>
<P>Soon we will be modifying this animation. For now you may wish to save it with some name such as <EM>Simple</EM>.</P>
<H4>Undamped Oscillator Homework</H4>
<P>Here are some "homework" exercises for your amusement and edification:</P>
<H5>Problem 1</H5>
<P>Modify the oscillator so that it has a period of 1.7 seconds.</P>
<H5>Problem 2</H5>
<P>For the unmodified oscillator with a period of 2.00 seconds, verify with a watch or clock that the period is at least roughly correct.</P>
<P>Now change the <EM>frames per second</EM> of the oscillator to 24 fps and observe what effect that has on the period.</P>
<P>Now modify the <EM>ActionScript</EM> in the actions layer to make the period 2.00 seconds for that frame rate. </P>
<H2>Comparing the Fake to the ActionScript Version</H2>
<P>First, within the resolution of the screen the ActionScript version is correct, not just an approximation that looks about right.</P>
<P>The power of the ActionScript approach becomes obvious if you consider trying to make the period of the oscillator, say, 1.7 seconds.This corresponds to 1.7 second * 12 frames / second = 20.4 frames. In the fake method, this is impossible: the period must be an integer number of frames. The ActionScript method has no such difficulty. </P>
<P>Personally, doing the above animation with ActionScript is a lot less work than faking it, but I am a physicist. Writing 9 lines of simple ActionScript for me is easier than adding those 4 keyframes, tween-ing and easing between them, and then removing the final frame.</P>
<P>In addition, the <EM>swf</EM> file for the ActionScript version is much smaller than the fake: 401 bytes versus 1062 bytes. Of course, both of these are tiny. For more complex projects, these size differences can rapidly multiply.</P>
<H2>Damped Harmonic Motion</H2>
<P>In the real world there are always dissipative forces. Thus instead of the undamped oscillator we have just studied, the <EM>damped</EM> harmonic oscillator is more realistic.</P>
<P>Real world dissipative forces are complex and surprisingly difficult to describe. A simple approximation which is mathematically tractable assumes that the dissipative force is proportional to and opposite in direction to the speed <STRONG>v</STRONG> of the object: </P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD width="22%">&nbsp;</TD>
<TD width="50%">
<DIV align=center><IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Eqn4.gif" width=92></DIV></TD>
<TD width="28%">
<DIV align=right>(4)</DIV></TD></TR></TBODY></TABLE>
<P>Here <IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/gamma.gif" width=15 align=absBottom>(pronounced <EM>gamma</EM>) is a constant called the <EM>damping factor</EM>.</P>
<P>We will also make the simplifying assumption that the mass of the oscillating object is 1.0 in whatever units we are using. </P>
<P>In this case the motion of the object is:</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD>&nbsp;</TD>
<TD>
<DIV align=center><IMG height=31 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Eqn5.gif" width=221></DIV></TD>
<TD>
<DIV align=right>(5)</DIV></TD></TR></TBODY></TABLE>
<P>In the above equation, <STRONG>e</STRONG> is the irrational number whose value is approximately 2.718. The term involving it, then, would read as "<STRONG>e</STRONG> to the power of minus gamma over 2 times the time t." Thus the maximum amplitude goes down <EM>exponentially</EM> as the time gets larger. The ActionScript construct for exponents is <SPAN class=style1><FONT face="Courier New">Math.exp()</FONT><SPAN class=style2><FONT face=Arial>.</FONT></SPAN></SPAN></P>
<P>In addition the angular frequency of the oscillation is changed a bit by the damping factor. If <IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/omega0.gif" width=24 align=absBottom> is the frequency the oscillator would have in the absence of damping and it is greater than <IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/gamma.gif" width=15 align=absBottom>/ 2, then the frequency of oscillation in Eqn (5) is: </P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD>&nbsp;</TD>
<TD>
<DIV align=center><IMG height=58 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Eqn6.gif" width=185></DIV></TD>
<TD>
<DIV align=right>(6)</DIV></TD></TR></TBODY></TABLE>
<TABLE width="100%">
<TBODY>
<TR>
<TD>
<P>Here is a plot of Eqn 5 for the following values:</P>
<P><IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/omega0.gif" width=24 align=absBottom>= <IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/pi.gif" width=16 align=absBottom>(This is the same value as in the previous plot of the undamped oscillator.)</P>
<P><IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/gamma.gif" width=15 align=absBottom> = 0.2</P>
<P>The dashed blue lines in the plot indicate the maximum amplitude of the oscillation. </P></TD>
<TD><IMG height=266 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/DampedPlot.gif" width=432></TD></TR></TBODY></TABLE>
<P>&nbsp;</P>
<H2>Animating the Damped Oscillator</H2>
<P>Animating the damped oscillator by faking it sounds like a ghastly idea. We may need to add frames to make the period come out at least roughly correct. Then we would need to take each cycle of the oscillation, copy and paste the frames, modify the maximum amplitudes using the above equations, and repeat until the oscillations are so small that they are invisible. We won't even try to do this, but will just do it with ActionScript. </P>
<P>We will modify the animation we did before for the undamped oscillator. If you do not already have the <EM>fla</EM> file of that animation open, do so. <EM>Save as </EM>using some name such as <EM>Damped</EM>.</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD width="49%">
<P>Change the actions to look as shown.</P>
<P>Some comments about the code: </P></TD>
<TD width="51%"><IMG height=307 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/DampedActions.gif" width=500></TD></TR></TBODY></TABLE>
<UL>
<LI>The period <STRONG>T</STRONG> is the value if there were no damping. 
<LI>In Line 5 the "natural" frequency is now named <STRONG>w0</STRONG>, where before it was called <STRONG>w</STRONG>. 
<LI>Lines 6 and 7 are new. 
<LI>Line 9 is modified from the undamped animation. 
<LI>We make Flash do all the work of calculating the new frequency <STRONG>w</STRONG>, the value of the exponentials, etc. In general the Actionscript interpreter embedded in the Flash player is quite fast, so making it do the work is almost always a good principle. </LI></UL>
<P>If you didn't make any mistakes, this will show damped harmonic motion. However, it will only work once! After the oscillations have died away the object will just sit there, an apparently motionless lump. Adding a button to reset the motion could be a good idea.</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD>Create a new layer called <EM>reset</EM> in the animation. Place any button that you wish from the Common Library in this layer. </TD>
<TD>
<DIV align=center><IMG height=373 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/DampedLayers.gif" width=360></DIV></TD></TR>
<TR>
<TD colSpan=2>
<HR>
</TD></TR>
<TR>
<TD>
<P>Select the button, and add this action to it.</P>
<P>All we are doing it resetting the time to 0 when the button is clicked. </P>
<P>The result is shown below. Depending on how long this page has been in your browser you may need to click on the blue rewind button now to see any motion.</P></TD>
<TD><IMG height=356 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/DampedResetActions.gif" width=450></TD></TR></TBODY></TABLE>
<P>
<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 height=100 width=550 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="_cx" VALUE="14552"><PARAM NAME="_cy" VALUE="2646"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="Flash/Damped.swf"><PARAM NAME="Src" VALUE="Flash/Damped.swf"><PARAM NAME="WMode" VALUE="Window"><PARAM NAME="Play" VALUE="0"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE=""><PARAM NAME="Scale" VALUE="ShowAll"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE=""><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="false">
            <embed src="Flash/Damped.swf" quality="high" 
pluginspage="http://www.macromedia.com/go/getflashplayer" 
type="application/x-shockwave-flash" width="550" height="100"></embed>  
</OBJECT></P>
<P>You may wish to save your work before going on. </P>
<H4>Homework on Damped Oscillation</H4>
<TABLE cellSpacing=5 cellPadding=5 width="100%">
<TBODY>
<TR>
<TD width="87%">For the damped oscillator, we say that the amplitude of the oscillation is <EM>modulated </EM>by the exponential term shown to the right: </TD>
<TD width="13%">
<DIV align=center><IMG height=31 alt="exponential damping term" src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/ExpDamping.gif" width=70></DIV></TD></TR></TBODY></TABLE>
<P>When two spring-mass systems are connected by a third spring, one type of motion that can result is given by the following equation:</P>
<TABLE cellSpacing=5 cellPadding=5 width="100%">
<TBODY>
<TR>
<TD>&nbsp;</TD>
<TD>
<DIV align=center><IMG height=24 alt="resonance equation for coupled oscillators" src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/ResonanceEqn.gif" width=268></DIV></TD>
<TD>&nbsp;</TD></TR></TBODY></TABLE>
<P>The maximum amplitude is modulated by a term that varies in time as a sine function with a <EM>modulation frequency </EM><IMG height=24 alt="modulation frequency" src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/ModFreq.gif" width=41 align=absBottom>.</P>
<TABLE cellSpacing=5 cellPadding=5>
<TBODY>
<TR>
<TD>
<DIV align=left>
<P>We then say that the amplitude is modulated by this term: </P></DIV></TD>
<TD>
<DIV align=right><IMG height=24 alt="modulation for resonance" src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/ResonantMod.gif" width=117></DIV></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=5 cellPadding=5 width="100%">
<TBODY>
<TR>
<TD>
<P>The figure to the right shows the position versus time for such motion. The red line is the motion of the object, and the blue lines show the modulation. </P>
<P>I have chosen a modulation frequency <IMG height=24 alt="modulation frequency" src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/ModFreq.gif" width=41 align=absBottom>= 0.2. All other parameters are identical to the damped oscillator example. </P></TD>
<TD><IMG height=266 alt="resonance motion" src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Resonance.gif" width=432></TD></TR></TBODY></TABLE>
<P>Animate this case. </P>
<H2>Another Approach to the Animation</H2>
<P>Physicists typically think about problems like the damped harmonic oscillator as the reaction of the <EM>system</EM>, the red ball, to forces imposed on it by the <EM>environment</EM>. That is the way the animation in the previous section was done: the motion is controlled by movements imposed on it by the <EM>actions</EM> layer of the Main Stage. Thus the Main Stage of the animation represents the physical environment acting on the ball.</P>
<P>Experienced Flash animators often think about their animations in a slightly different way. They have the object control its own motion, sometimes depending on its local environment. In Physics, this is the approach of the General Theory of Relativity. It is also the basis of <EM>Turtle Graphics</EM>, popularised by Seymour Papert and others at MIT. We will re-write the damped harmonic oscillator using this approach.</P>
<P>If you do not have the <EM>Damped</EM> fla file from the previous section open, you should do so and then <EM>Save as</EM> using some name such as <EM>Damped2</EM>.</P>
<TABLE width="100%">
<TBODY>
<TR>
<TD>
<P>Select the <EM>sphere</EM> movie clip and open the <EM>Actions</EM> panel. Enter the code shown to the right. Cutting and pasting from the <EM>actions</EM> layer can save you some typing. </P>
<P>The variables are set when the clip is loaded.</P>
<P>Note that in Line 3 we set the initial position of the sphere by where it is on the Main Stage. All the Properties of the clip are similarly available. </P></TD>
<TD><IMG height=316 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Damped2Actions.gif" width=500></TD></TR></TBODY></TABLE>
<P>Then the motion of the clip is controlled on every entry to the frame, just as before. Note that in Line 11 we do not refer to the name of the instance of the movie clip, <EM>sphere</EM> in this case. Since the code is associated with the clip, not being imposed on it from the outside, such a specification is not needed. </P>
<P>Delete the <EM>actions</EM> layer from the Main Stage. Now only the layer containing the <EM>sphere</EM> instance of the <EM>sphere_mc</EM> movie clip and the layer containing the rewind button remain.</P>
<P>If you have not made any mistakes, you should see the damped oscillator almost like the one discussed in the previous section. However, there is still a problem: the rewind button no longer works.</P>
<P>The reason is that the time variable <EM>t</EM> that controls the motion is now part of the <EM>sphere</EM> clip, and the rewind button controls a variable of the same name but that is associated with the Main Stage. </P>
<TABLE width="100%">
<TBODY>
<TR>
<TD>
<P>Select the rewind button and open the <EM>Actions</EM> panel. Modify the code so that it looks as shown.</P>
<P>Now we are setting the time variable <EM>t</EM> of the <EM>sphere</EM> clip when the button is clicked. </P>
<P>This animation now behaves identically to the one of the previous section, so I will not include it in this document. </P></TD>
<TD><IMG height=385 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Damped2ResetActions.gif" width=485></TD></TR></TBODY></TABLE>
<P>So in this approach, the clip controls itself but to reset the time we impose a value from the Main Stage. </P>
<TABLE width="100%" border=0>
<TBODY>
<TR>
<TD>I used a similar approach in doing an animation of nuclear radioactive decays. You may see the animation by clicking on the blue button to the right; it will appear in a separate window and has a file size of 27k. </TD>
<TD><A href="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Nuclear/Decay/NuclearDecay.html" target=_blank><IMG height=58 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/bluebutton.gif" width=30 border=2></A></TD></TR></TBODY></TABLE>
<P>Here, there are 500 copies of a nucleus movie clip and each one decides independently when it will decay. The time of decay is randomised, through a programming construct called a <EM>Monte Carlo calculation</EM> (after the casino). There is one caveat which I should point out: the <SPAN class=style1><FONT face="Courier New">onClipEvent()</FONT><SPAN class=style2><FONT face=Arial> call can only be used for an <EM>instance</EM> of a movie clip. Thus the code in the Nuclear Decay does not use this function; instead it uses </FONT><SPAN class=style1><FONT face="Courier New">onEnterFrame = function()... </FONT><SPAN class=style2><FONT face=Arial>calls.</FONT></SPAN></SPAN></SPAN></SPAN></P>
<H2>A Numerical Approximation</H2>
<P>For the undamped oscillator, <A href="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/FlashPhysics.html#undamped"><FONT color=#000000>above</FONT></A> we stated without proof that the position of the sphere changes with time according to:</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD width="5%">&nbsp;</TD>
<TD width="85%">
<DIV align=center><IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Eqn2.gif" width=159></DIV></TD>
<TD width="10%">
<DIV align=right></DIV></TD></TR></TBODY></TABLE>
<P>This sort of motion arises when a mass is attached to a spring. Getting from the force exerted by the spring to the above relation involves solving a <EM>differential equation</EM>. In this section we will again produce an animation of the undamped oscillator, but will use only the relation between force, acceleration, speed and position.</P>
<TABLE cellSpacing=5 cellPadding=5 width="100%">
<TBODY>
<TR>
<TD>
<P>There is an equilibrium position for a spring, <STRONG>x<SUB>0</SUB></STRONG>, and when the mass is at that position the spring exerts no force on it. This is shown in the upper part of the figure. </P>
<P>When the mass is not at the equilibrium position, as in the lower part of the figure, the force exerted by the spring is always directed towards the equilibrium position. Thus the force is often called a <EM>restoring force</EM>.</P></TD>
<TD>
<DIV align=center><IMG height=348 alt="spring-mass system" src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/SpringMass.jpg" width=305></DIV></TD></TR></TBODY></TABLE>
<P>It turns out that to a fairly good approximation, the force exerted by the spring is proportional to the distance from the equilibrium position. This is called <EM>Hooke's Law</EM> and mathematically is:</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD width="5%">&nbsp;</TD>
<TD width="85%">
<DIV align=center><IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/HookesLaw.gif" width=158></DIV></TD>
<TD width="10%">
<DIV align=right>(7)</DIV></TD></TR></TBODY></TABLE>
<P>Here <STRONG>k</STRONG> is a constant for a particular spring. The first minus sign indicates that the force is restoring: if <STRONG>x</STRONG> is greater than <STRONG>x<SUB>0</SUB></STRONG> the force is negative; if <STRONG>x</STRONG> is less than <STRONG>x<SUB>0</SUB></STRONG> the force is positive. Thus the force always points towards the equilibrium position.</P>
<P>Newton taught us the relation between forces <STRONG>F</STRONG>, masses <STRONG>m</STRONG> and the acceleration <STRONG>a</STRONG>:</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD width="5%">&nbsp;</TD>
<TD width="85%">
<DIV align=center><IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Newton.gif" width=74></DIV></TD>
<TD width="10%">
<DIV align=right>(8)</DIV></TD></TR></TBODY></TABLE>
<P>Combining these two equations gives the relationship between the acceleration and the position of the mass:</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD width="5%">&nbsp;</TD>
<TD width="85%">
<DIV align=center><IMG height=46 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Eqn9.gif" width=317></DIV></TD>
<TD width="10%">
<DIV align=right>(9)</DIV></TD></TR></TBODY></TABLE>
<P>The constant <STRONG>c</STRONG> equals the spring constant divided by the value of the mass.</P>
<P>The acceleration is the rate of change of the speed. Thus, if the mass has an initial speed <STRONG>v<SUB>i</SUB></STRONG> then after a small time <STRONG>dt</STRONG> its final speed <STRONG>v<SUB>f</SUB></STRONG> is:</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD width="5%">&nbsp;</TD>
<TD width="85%">
<DIV align=center><IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Eqn10.gif" width=144></DIV></TD>
<TD width="10%">
<DIV align=right>(10)</DIV></TD></TR></TBODY></TABLE>
<P>Similarly, the speed is the rate of change of the position, so:</P>
<TABLE cellSpacing=5 cellPadding=1 width="100%">
<TBODY>
<TR>
<TD width="5%">&nbsp;</TD>
<TD width="85%">
<DIV align=center><IMG height=24 src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/Eqn11.gif" width=144></DIV></TD>
<TD width="10%">
<DIV align=right>(11)</DIV></TD></TR></TBODY></TABLE>
<P>We create a <EM>sphere</EM> instance of a sphere movie clip, just as in the <A href="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/FlashPhysics.html#doingit"><FONT color=#000000>Doing It With ActionScript section</FONT></A>, and create an <EM>actions</EM> layer. </P>
<TABLE cellSpacing=5 cellPadding=5 width="100%">
<TBODY>
<TR>
<TD>
<P>Here is the code in the <EM>actions</EM> layer implementing Equations 9, 10, and 11. The result is shown below. </P>
<P>Note that the <EM>ActionScript</EM> has no trig functions, and just increments the speed based on the current value of the acceleration and the position based on the value of the speed. However, it sure <EM>looks</EM> like the position is varying with time like a sine function. </P></TD>
<TD><IMG height=300 alt="Numerical integration actions" src="http://www.upscale.utoronto.ca/PVB/Harrison/Flash/Tutorial/Images/NumIntActions.gif" width=432></TD></TR></TBODY></TABLE>
<P>
<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 height=100 width=550 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000><PARAM NAME="_cx" VALUE="14552"><PARAM NAME="_cy" VALUE="2646"><PARAM NAME="FlashVars" VALUE=""><PARAM NAME="Movie" VALUE="Flash/NumIntegration.swf"><PARAM NAME="Src" VALUE="Flash/NumIntegration.swf"><PARAM NAME="WMode" VALUE="Window"><PARAM NAME="Play" VALUE="0"><PARAM NAME="Loop" VALUE="-1"><PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE=""><PARAM NAME="Menu" VALUE="-1"><PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE=""><PARAM NAME="Scale" VALUE="ShowAll"><PARAM NAME="DeviceFont" VALUE="0"><PARAM NAME="EmbedMovie" VALUE="0"><PARAM NAME="BGColor" VALUE=""><PARAM NAME="SWRemote" VALUE=""><PARAM NAME="MovieData" VALUE=""><PARAM NAME="SeamlessTabbing" VALUE="1"><PARAM NAME="Profile" VALUE="0"><PARAM NAME="ProfileAddress" VALUE=""><PARAM NAME="ProfilePort" VALUE="0"><PARAM NAME="AllowNetworking" VALUE="all"><PARAM NAME="AllowFullScreen" VALUE="false">
            <embed src="Flash/NumIntegration.swf" quality="high" 
pluginspage="http://www.macromedia.com/go/getflashplayer" 
type="application/x-shockwave-flash" width="550" height="100"></embed>  
</OBJECT></P>
<P>There are some subtleties in the three simple lines of code that update the acceleration, speed and position. For example, as written we update the position <STRONG>x</STRONG> using the <EM>new</EM> value of the speed <STRONG>v</STRONG>. If we reverse the lines updating <STRONG>x</STRONG> and <STRONG>v</STRONG> we update the position with the <EM>old</EM> value of the speed:</P><PRE class=style3>	...
	a = -c * (x - x0);
	x += v * dt;
	v += a * dt
	...
</PRE>
<P>One could also imagine updating the position using an average of the old and new values for the speeds. These subtleties are beyond the scope of this document: googling "Euler's method" can get you started on learning about them. There is also a small note about this and the above animation at the end of this section. </P>
<P>Also, Equations 10 and 11 are only true when the "time step" <STRONG>dt</STRONG> is infinitesimally small. Above I have set the time step to one over the frames per second of the animation, 1/12 = 0.08333... This is pretty small, but certainly not infinitesimally small.</P>
<P>We can increase the accuracy of the animation by putting a loop inside the onEnterFrame function to reduce the size of the time step used in doing the calculation. Here is some code which reduces the effective time step to 1/1200 = 0.00008333... : </P><PRE class=style3>onEnterFrame = function()&#123;
	for(i = 1; i &lt;= 1000; i++) &#123;
		a = -c * (x - x0);
		v += a * dt/1000;
		x += v * dt/1000;
	&#125;
	sphere._x = x;
&#125;
</PRE>
<P>Of course, this increases the number of computations that must be done for each frame by a factor of 1000. Assuming a reasonably fast computer, this modification has no visible effect on the animation, so I do not bother to display it.</P>
<P>Finally, although this technique of "numerical integration" doesn't have many benefits for the undamped oscillator there are circumstances, such as many problems in chaos, in which no analytic solution exists. In these cases numerical integration is often the only way to do the animation.</P>]]></description>
      <comments>http://super-genius.webs.com/genius1.htm?blogentryid=3181290#topBox</comments>
      <guid isPermaLink="true">http://super-genius.webs.com/genius1.htm?blogentryid=3181290</guid>
      <pubDate>Mon, 24 Mar 2008 18:12:00 -0100</pubDate>
    </item>

    <item>
      <title><![CDATA[Types of Flash animation I like to work with]]></title>
      <link>http://super-genius.webs.com/genius1.htm?blogentryid=3181235</link>
      <description><![CDATA[<P><B>3D Animation</B> 
<P><IMG hspace=5 src="http://www.toondoctor.com/images/flashcartoon05.jpg" align=left vspace=3> Several 3D animation software export contents in Flash. You create your project as a 3D animation and render it for Flash. If adopting such a technique, remember that you should probably optimize your renderings within Macromedia Flash and not just publish them for the Web. 3D renderings in Flash are often too large and waste your viewer's time. 
<P><B>2D Animation</B> 
<P>Professional animation programs that work with traditional hand drawings allow you to export the contents for Flash. Again, as with 3D animation, the projects will not be optimized Flash files and you should reedit them in Flash. Check if the 2D and 3D animation programs render your Flash projects. Make sure they look good and that if they use bitmaps that they are small and clean. 
<P><B>ActionScript</B> 
<P>As traditional animators, we favour working with visuals rather than code. However, many people prefer to program interactions and motion within Flash. Our rule of thumbs is simple. If it takes more time to script a motion and if it's heavier, animate visually. We believe that ActionScript works best for planned motion sequences, like in video games rather than total animation. 
<P>For example, using ActionScript to set the behaviour or a character when faced with an obstacle is probably a better use of the technology. Since the possible reactions are drawn in advance and saved as movie clips, recalling a specific behaviour from a library makes more sense than scripting a walk sequence with ActionScript. 
<P><B>Hand Animation</B> 
<P>For us, hand animation is our favourite and ultimate animation technique when working with Flash. That's because planning an animated project in Flash or for television should be no different. Hand drawing is great because animators make mistakes and add imperfections. Imperfections are what makes cartoon animation lively. Perfectly smooth animation is boring. 
<P><IMG hspace=5 src="http://www.toondoctor.com/images/flashcartoon06.jpg" align=left vspace=3> Flash works very well with traditional animation unlike other programs such as Adobe After Effects or Live Motion, as we discussed earlier. Each frame contains a different drawing that brings variety and breaks the mechanical aspect of cartoon animation done with computers. Hand animation takes more time, cost more but usually makes compelling and attractive projects. 
<P><B>Puppet Animation</B> 
<P>By Puppet animation, we refer to animation with a library of objects, like our Quickquack animation. In our case, we built our Quickquack puppet animation on a hand-animated version. We put the clean digital parts on top of the pencil draft. While many people use puppet animation for lip sync, few go beyond that. 
<P>Puppet animation is fun because once you have the motion and gesture of the character set, you can replace the standard parts with anything, like papier mach&#233;, a child's crayola scribbles, painted parts or photos. Since all you do is add the parts on top of a guide, creativity and experiments are encouraged. </P>]]></description>
      <comments>http://super-genius.webs.com/genius1.htm?blogentryid=3181235#topBox</comments>
      <guid isPermaLink="true">http://super-genius.webs.com/genius1.htm?blogentryid=3181235</guid>
      <pubDate>Mon, 24 Mar 2008 18:03:00 -0100</pubDate>
    </item>

  </channel>
</rss>

