<?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>mostly a codeBlog</title>
	<atom:link href="http://www.rickigregersen.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rickigregersen.com</link>
	<description>whatever I am currently programming... and I truly digress</description>
	<lastBuildDate>Sun, 17 Jan 2010 07:21:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>No More Virtual Machines</title>
		<link>http://www.rickigregersen.com/2010/01/17/no-more-virtual-machines/</link>
		<comments>http://www.rickigregersen.com/2010/01/17/no-more-virtual-machines/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 07:21:09 +0000</pubDate>
		<dc:creator>Ricki</dc:creator>
				<category><![CDATA[Objective C]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://www.rickigregersen.com/?p=224</guid>
		<description><![CDATA[Sorry for the 3 month dry streak.
I was fired back in, think it was August?  . I then had a three month &#8220;paid vaccination&#8221;(it was in my contract that in the event I was fired they had to pay me for 3 months but I didn&#8217;t have to come to work&#8230;sweet). Did some consulting [...]]]></description>
			<content:encoded><![CDATA[<p>Sorry for the 3 month dry streak.</p>
<p>I was fired back in, think it was August? <img src='http://www.rickigregersen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . I then had a three month &#8220;paid vaccination&#8221;(it was in my contract that in the event I was fired they had to pay me for 3 months but I didn&#8217;t have to come to work&#8230;sweet). Did some consulting work, mostly to have something to do. Then I thought to my self that this was an excellent time to set a dream of mine in motion. I come from a background in computer and electronic engineering.</p>
<p>In my Flash/Java work I always had this strange feeling in the back of my head going &#8220;At some point this is going to break or perform strangely, and I have no way, other that trial and error, to figure out why&#8221;. This is harshly put, but I have been used to dealing with µControllers, the C language and copper-wire  for a long time and even though I appreciate things that &#8220;just work&#8221; as much as the next guy, I also feel the complete despair when it does not and you have no way of getting &#8220;under the hood&#8221;.</p>
<p>Im probably being ignorant and if I would I could sit down and read up on every nook and cranny of the runtime, then I would be the all-omnipotent, all-mighty and know-it-all master of&#8230; a nook.</p>
<p>My previous job involved building Flash apps for the AIR  runtime environment, I know, I know, that is asking for trouble(2007-2009), and my only real choice of an editor was Eclipse. Im a Mac user and that just &#8220;grinds my gears&#8221; to have to use some &#8220;lowest common denominator&#8221; GUI for what I do with most of the hours Im awake.</p>
<p>I have a duality in my that dictates that I love building stuff for the internal intricacies and that I only can enjoy software, furniture, food TV series etc. if I know the order and beauty that governs the inside also governs the outside, i.e. I like good design on both the inside and the outside.</p>
<p>So how do I get to work with µControllers and hardware, beautiful interfaces and have a set of development tools that doesn&#8217;t hate me and gives me a stack dump when I ask for it?</p>
<p><strong>I have become an iPhone developer!</strong></p>
<p>OK, plan&#8230; by rationing my means I can sustain myself for almost a year. In that timeframe I should be able to (a) learn Objective C (b) get a few apps in the store (c) go down new roads and be happy:)</p>
<p>So for the last three months I have been developing an app that will _blank_ for _blank_ when you go _blank_, with a designer called Mino, which is a secretive guy, hence the _blank_ <img src='http://www.rickigregersen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Now we are close to a Beta version and I my head is exploding with pieces of info that I would like to put on the blog. Im at the state of learning a new language where I bought the first &#8220;pattern book&#8221;, which means I did a lot of <em>&#8220;ahh this seems to be the way to go&#8221; </em>only to go <em>&#8220;ahh so that is how I should have done it&#8221;</em> a few hours later. Well, to cut it short, I don&#8217;t think there will be a lot of AS &#8211; Java stuff on the blog in the time to come, but I hope to keep doing the visual experiments and give out some code snippets.</p>
<p>I&#8217;ll surely move on to building some Mac software afterwards, I like the tools, the Apple frameworks has the standard of the Apple hardware (95% perfect and 5% &#8220;WTF, this took me forever and now it&#8217;s broken again&#8221;) also I get the &#8220;complete package experience&#8221; that I was missing in my other endeavors.</p>
<p>So please spread the word that Im up for crazy and exciting projects, both here in DK and abroad.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rickigregersen.com/2010/01/17/no-more-virtual-machines/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Packing Circles &#8211; The Stupid Way</title>
		<link>http://www.rickigregersen.com/2009/09/21/packing-circles-the-stupid-way/</link>
		<comments>http://www.rickigregersen.com/2009/09/21/packing-circles-the-stupid-way/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 22:01:56 +0000</pubDate>
		<dc:creator>Ricki</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[circle]]></category>
		<category><![CDATA[packing]]></category>

		<guid isPermaLink="false">http://www.rickigregersen.com/?p=221</guid>
		<description><![CDATA[This is a small experiment I did on &#8220;packing circles&#8221;. The circles are not really packed, the program just keeps suggesting circles of varying sizes in different positions on the screen and then tests to see if they will fit. If they fit they are drawn if not they are discarded.
Example and code here
]]></description>
			<content:encoded><![CDATA[<p>This is a small experiment I did on &#8220;packing circles&#8221;. The circles are not really packed, the program just keeps suggesting circles of varying sizes in different positions on the screen and then tests to see if they will fit. If they fit they are drawn if not they are discarded.</p>
<div id="attachment_222" class="wp-caption aligncenter" style="width: 521px"><a href="http://www.rickigregersen.com/wp-content/uploads/circlePacking.png"><img class="size-full wp-image-222" title="circlePacking" src="http://www.rickigregersen.com/wp-content/uploads/circlePacking.png" alt="A small 5 min. run of the program" width="511" height="510" /></a><p class="wp-caption-text">A small 5 min. run of the program</p></div>
<p><a href="http://www.rickigregersen.com/wp-content/circleapplet/">Example and code here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rickigregersen.com/2009/09/21/packing-circles-the-stupid-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DTXplorer drum kit goes Processing</title>
		<link>http://www.rickigregersen.com/2009/09/09/dtxplorer-drum-kit-goes-processing/</link>
		<comments>http://www.rickigregersen.com/2009/09/09/dtxplorer-drum-kit-goes-processing/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 00:01:27 +0000</pubDate>
		<dc:creator>Ricki</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[drum]]></category>
		<category><![CDATA[DTXplorer]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[MIDI]]></category>
		<category><![CDATA[Midipipe]]></category>
		<category><![CDATA[OSC]]></category>
		<category><![CDATA[Osculator]]></category>

		<guid isPermaLink="false">http://www.rickigregersen.com/?p=199</guid>
		<description><![CDATA[This my DTXplorer drumkit getting feed into MidiPipe onto Osculator and finally ends up in Processing. Now thats beat detection!
I have taken some time to get my Yamaha DTXplorer electronic drums to communicate nicely with my Mac, finally it worked out and I can now &#8220;harvest&#8221; the sweet, sweet MIDI coming from the drums. Im [...]]]></description>
			<content:encoded><![CDATA[<h5>This my DTXplorer drumkit getting feed into MidiPipe onto Osculator and finally ends up in Processing. Now thats beat detection!</h5>
<a href="http://www.rickigregersen.com/2009/09/09/dtxplorer-drum-kit-goes-processing/"><p><em>Click here to view the embedded video.</em></p></a><br />
<a href="http://www.rickigregersen.com/2009/09/09/dtxplorer-drum-kit-goes-processing/"><p><em>Click here to view the embedded video.</em></p></a>
<p>I have taken some time to get my <a href="http://www.yamaha.com/drums/drumproductdetail.html?CNTID=544640&amp;CTID=5040587">Yamaha DTXplorer</a> electronic drums to communicate nicely with my Mac, finally it worked out and I can now &#8220;harvest&#8221; the sweet, sweet MIDI coming from the drums. Im no Moby, so believe me when I say these last one and a half days of frustrations was not to immortalize the sound of my drumming. It was, of course to get the data into <a href="http://www.processing.org">Processing</a>. A friend of mine is a DJ and he wanted us to experiment with playing &#8220;live&#8221; drums along with the turntables. Furthermore, to make some sort of visualization that would be 100% true to the beat. This is very hard I found out, there are a lot of good sound libraries with beat detection out there, but they are never plug n&#8217; play. You need to tweak your code for every single song and even that is no guarantee for a consistent output. I came up with a pretty straight forward solution, if we were to use the electronic drums anyway we could just as well use the MIDI for the beat detection and then have the turntables control the colors.</p>
<p>I found out that I needed a few different applications and a MIDI cable before I got the signal all the way through. First off is the <a href="http://www.esi-audio.com/products/midimate2/">ESI MidiMate</a> cable, I actually had the old model, but I think it was broken and could not handle if the MIDI in was not connected to a ground plane. It was 295 Danish Kroner ( ≈$55 ). Then I needed <a href="http://web.mac.com/nicowald/SubtleSoft/MidiPipe.html">MidiPipe</a>. This a free application developed by Nico Wald and it is brilliant! Should I ever make any money with this setup I will run to a browser and donate some money to Nico.<br />
The idea with MidiPipe is that it &#8220;hijacks&#8221; every single MIDI port it can detect on the system, you then drag the one you need to the pipe(ESI MIDIMATE Port 1 turn up in MidiPipe the second I connected it to the drumkit) you can then drag other stuff into the pipe. I dragged in &#8220;AList&#8221; from the &#8220;Modifier&#8221; and that gave me just what it says, a list of all midi signals passing through MidiPipe.</p>
<div id="attachment_201" class="wp-caption aligncenter" style="width: 506px"><a href="http://www.rickigregersen.com/wp-content/uploads/midipipe.png"><img class="size-full wp-image-201" title="midipipe" src="http://www.rickigregersen.com/wp-content/uploads/midipipe.png" alt="MidiPipe is a life-saver" width="496" height="512" /></a><p class="wp-caption-text">MidiPipe is a life-saver</p></div>
<p>This was a cool way of testing out the drums. Lastly I dragged a &#8220;MIDI out&#8221; into the Pipe, more about that in a second. Then I went out and finally bought that license for <a href="http://www.osculator.net/wp/">OSCulator</a>. Osculator have been running my Wiimote, iPhone, Arduino and Make controller for the last year and I have been to lazy/cheap to just buy the license. Well Osculator is a $15 minimum, but Camille asks people nicely to pay $39, which I did, of course, having used his software for about a year now. What Osculator can do is just to much to explain here&#8230; I needed it to translate my MIDI into OSC (because OSC is the new MIDI <img src='http://www.rickigregersen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ) and then relay the rewritten data to a port on localhost using UDP. This was done so I could have some control over the data, also I now get something along the lines of &#8220;snare &#8211; on &#8211; 0.6&#8243; (thats the pad sending the message, that it was &#8220;on&#8221;/hit and the strength it was hit with) into Processing instead of some MIDI byte I have to bitwise shift around to get any data from it, it just makes debugging easier and sending something through Osculator opens a world of other possibilities.</p>
<div id="attachment_204" class="wp-caption aligncenter" style="width: 522px"><a href="http://www.rickigregersen.com/wp-content/uploads/osculator1.png"><img class="size-full wp-image-204" title="osculator" src="http://www.rickigregersen.com/wp-content/uploads/osculator1.png" alt="It is just crazy how many features there can be in such a simple application" width="512" height="484" /></a><p class="wp-caption-text">It is just crazy how many features there can be in such a simple application</p></div>
<p>A note here, when I started Osculator, MidiPipe noticed Osculator was listening on port 8000 and stuffed that piece of information into the &#8220;MIDI out&#8221; I mentioned earlier, now I could just select it there. So now my MIDI came in through MidiPipe, was listed for me to see and then relayed on to Osculator. In Osculator I caught each MIDI event and by selecting the signal and going Osculator &#8211; Edit &#8211; Demux, I could split the signal into its components and rebroadcast them as OSC messages on the network. For handling OSC Protocol stuff in Processing Andreas Schlegel did a really great library, you can get it <a href="http://www.sojamo.de/libraries/oscP5/">here</a> along with some other goodies Andreas made.</p>
<p>I now had 8 different OSC messages, one for each drum pad, cymbal and foot pedal (Im going to do the high hat pedal later on) that I can read out in Processing. I did a small sketch as you see in the video and just started the &#8220;play along&#8221; feature on my DTXplorer kit, with some &#8220;Hard Rock&#8221; <img src='http://www.rickigregersen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  selected and and the computers microphone recording.</p>
<p>And as always if there is some code or help You need just leave a mail or comment.</p>
<p><a href="http://www.rickigregersen.com/wp-content/uploads/midiProcessing.mov">A version not completely compressed by the geniuses over at youtube</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rickigregersen.com/2009/09/09/dtxplorer-drum-kit-goes-processing/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
<enclosure url="http://www.rickigregersen.com/wp-content/uploads/midiProcessing.mov" length="1515678" type="video/quicktime" />
		</item>
		<item>
		<title>Fake Gravity Fluid</title>
		<link>http://www.rickigregersen.com/2009/08/31/fake-gravity-fluid/</link>
		<comments>http://www.rickigregersen.com/2009/08/31/fake-gravity-fluid/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 22:01:41 +0000</pubDate>
		<dc:creator>Ricki</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Particle]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[flow field]]></category>
		<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://www.rickigregersen.com/?p=196</guid>
		<description><![CDATA[I was playing around with the Traer Physics Library for processing/java. It is really fast but even though I had done some small experiments with it a year or so back, I still had to dig out the manual and refresh some basic stuff.
Well Im looking into the whole FluidSolver thing, again, and I thought [...]]]></description>
			<content:encoded><![CDATA[<p>I was playing around with the <a href="http://www.cs.princeton.edu/~traer/physics/">Traer Physics Library</a> for processing/java. It is really fast but even though I had done some small experiments with it a year or so back, I still had to dig out the manual and refresh some basic stuff.<br />
Well Im looking into the whole FluidSolver thing, again, and I thought it could be fun to do a fast and crude Newtonian approach and just go for an effect that looks a bit like it, but is far more simple.</p>
<p><img src="http://www.rickigregersen.com/wp-content/uploads/fluid.png" alt="16834 particles fakes fluid" /></p>
<p><a href="http://www.rickigregersen.com/wp-content/uploads/fluid_applet/index.html">Example and code here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rickigregersen.com/2009/08/31/fake-gravity-fluid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SporeTree</title>
		<link>http://www.rickigregersen.com/2009/08/11/sporetree/</link>
		<comments>http://www.rickigregersen.com/2009/08/11/sporetree/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 21:21:02 +0000</pubDate>
		<dc:creator>Ricki</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Bitmap]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[recursive]]></category>
		<category><![CDATA[spore]]></category>
		<category><![CDATA[tree]]></category>

		<guid isPermaLink="false">http://www.rickigregersen.com/?p=193</guid>
		<description><![CDATA[This time the spores turned into a tree. It is by no means perfect, the branches does not move upwards with the stem as it should, were this a real orange colored scary spore tree.
This was just some &#8220;while Im doing nothing, let&#8217;s put whatever in the &#8216;fun&#8217; category&#8221;   but if anyone would [...]]]></description>
			<content:encoded><![CDATA[<p>This time the <a href="http://www.rickigregersen.com/?paged=2">spores</a> turned into a tree. It is by no means perfect, the branches does not move upwards with the stem as it should, were this a real orange colored scary spore tree.</p>
<p>This was just some &#8220;while Im doing nothing, let&#8217;s put whatever in the &#8216;fun&#8217; category&#8221; <img src='http://www.rickigregersen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  but if anyone would like the code, throw me a comment and I&#8217;ll send it off. I is uncommented and messy.</p>
<p><object width="512" height="750" data="http://www.rickigregersen.com/wp-content/uploads/BitmapSporeGrowingTree.swf" type="application/x-shockwave-flash"><param name="quality" value="high" /><param name="scale" value="exactfit" /><param name="salign" value="l" /><param name="wmode" value="transparent" /><param name="src" value="http://www.rickigregersen.com/wp-content/uploads/BitmapSporeGrowingTree.swf" /></object></h4>
]]></content:encoded>
			<wfw:commentRss>http://www.rickigregersen.com/2009/08/11/sporetree/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Circle Intersection</title>
		<link>http://www.rickigregersen.com/2009/08/09/circle-intersection/</link>
		<comments>http://www.rickigregersen.com/2009/08/09/circle-intersection/#comments</comments>
		<pubDate>Sun, 09 Aug 2009 21:17:42 +0000</pubDate>
		<dc:creator>Ricki</dc:creator>
				<category><![CDATA[Processing]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[circle]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[intersection]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[noise]]></category>
		<category><![CDATA[Perlin]]></category>

		<guid isPermaLink="false">http://www.rickigregersen.com/?p=190</guid>
		<description><![CDATA[&#8220;What is the point&#8221;
 was my first thought on this.
I had to do some calculations on the intersections between circles, that was pretty straight forward and I got a class written up in Processing that could do just that.
Then I started playing around and ended up moving 10 circles around the screen using Perlin noise [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>&#8220;What is the point&#8221;</p></blockquote>
<p> was my first thought on this.<br />
I had to do some calculations on the intersections between circles, that was pretty straight forward and I got a class written up in Processing that could do just that.<br />
Then I started playing around and ended up moving 10 circles around the screen using Perlin noise and if any of them intersects, I draw a dot. Pointless? certainly!</p>
<p>Maybe there is someone out there with an idea on how to make this into something other that a cpu hogging math feast. I would love to hear from You:)</p>
<p>Well there is some Perlin movement, some ArrayList looping and of course that class that takes 2 circles and returns their intersection, maybe someone can use that for something useful.<br />
<img src="http://rickigregersen.com/wp-content/uploads/circleIntersection.png" alt="A short run, maybe it get's better?" /></p>
<p><a href="http://www.rickigregersen.com/wp-content/uploads/circleApplet/index.html">Example and code here:</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rickigregersen.com/2009/08/09/circle-intersection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Processing Tentacles</title>
		<link>http://www.rickigregersen.com/2009/08/08/processing-tentacles/</link>
		<comments>http://www.rickigregersen.com/2009/08/08/processing-tentacles/#comments</comments>
		<pubDate>Sat, 08 Aug 2009 16:16:38 +0000</pubDate>
		<dc:creator>Ricki</dc:creator>
				<category><![CDATA[Particle]]></category>
		<category><![CDATA[Processing]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[Bitmap]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.rickigregersen.com/?p=185</guid>
		<description><![CDATA[I just did a quick port to processing, important to notice that these classes are &#8220;as is&#8221;, but still, the speed of Java compared to Flash is&#8230; well lets just say the gap isn&#8217;t quite gone yet  
EDIT: forgot some int/float math that made the tentacles look bulky&#8230; better now.
Example and code here:
]]></description>
			<content:encoded><![CDATA[<p>I just did a quick port to processing, important to notice that these classes are &#8220;as is&#8221;, but still, the speed of Java compared to Flash is&#8230; well lets just say the gap isn&#8217;t quite gone yet <img src='http://www.rickigregersen.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>EDIT: forgot some int/float math that made the tentacles look bulky&#8230; better now.<br />
<a href="http://www.rickigregersen.com/wp-content/uploads/applet/index.html">Example and code here:</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rickigregersen.com/2009/08/08/processing-tentacles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Growing Homegrown Tentacles</title>
		<link>http://www.rickigregersen.com/2009/08/08/growing-homegrown-tentacles/</link>
		<comments>http://www.rickigregersen.com/2009/08/08/growing-homegrown-tentacles/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 23:30:19 +0000</pubDate>
		<dc:creator>Ricki</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.rickigregersen.com/?p=183</guid>
		<description><![CDATA[Well, I just got time to look into how to get the tentacles growing, i.e. start out small and have all the joints gradually increase in size, instead of the joint getting smaller all the time. (think I just tried to explain the definition of growing by using the definition of growing??).
Thanks again to Justin.

The [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I just got time to look into how to get the tentacles growing, i.e. start out small and have all the joints gradually increase in size, instead of the joint getting smaller all the time. (think I just tried to explain the definition of growing by using the definition of growing??).</p>
<p>Thanks again to <a href="http://blog.soulwire.co.uk/">Justin</a>.</p>
<p><object width="512" height="512" data="http://www.rickigregersen.com/wp-content/uploads/BitmapSporeGrowing.swf" type="application/x-shockwave-flash"><param name="quality" value="high" /><param name="scale" value="exactfit" /><param name="salign" value="l" /><param name="wmode" value="transparent" /><param name="src" value="http://www.rickigregersen.com/wp-content/uploads/BitmapSporeGrowing.swf" /></object></h4>
<p>The spore Class turned out to look like this, it needs going over, but I was thinking on porting it to Processing and really get my tentacles on <img src='http://www.rickigregersen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The code:</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('p183code2'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p1832"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
</pre></td><td class="code" id="p183code2"><pre class="actionscript" style="font-family:monospace;">package 
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Graphics</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Point</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">utils</span>.<span style="color: #006600;">setTimeout</span>;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Spore <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> const <span style="color: #0066CC;">LENGTH</span>:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">90</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _posX:Vector.<span style="color: #66cc66;">&lt;</span>Number<span style="color: #66cc66;">&gt;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _posY:Vector.<span style="color: #66cc66;">&lt;</span>Number<span style="color: #66cc66;">&gt;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> angStep:<span style="color: #0066CC;">Number</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> posStep:<span style="color: #0066CC;">Number</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> curl:<span style="color: #0066CC;">Number</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> a:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">2</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _index:<span style="color: #0066CC;">int</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _g:Graphics;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Spore<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			_posX = <span style="color: #000000; font-weight: bold;">new</span> Vector.<span style="color: #66cc66;">&lt;</span>Number<span style="color: #66cc66;">&gt;</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">LENGTH</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
			_posY = <span style="color: #000000; font-weight: bold;">new</span> Vector.<span style="color: #66cc66;">&lt;</span>Number<span style="color: #66cc66;">&gt;</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">LENGTH</span>, <span style="color: #000000; font-weight: bold;">true</span> <span style="color: #66cc66;">&#41;</span>;
			_g = graphics;
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">generate</span><span style="color: #66cc66;">&#40;</span> range<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0.01</span>, <span style="color: #cc66cc;">0.05</span> <span style="color: #66cc66;">&#41;</span>, range<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">2.0</span>, <span style="color: #cc66cc;">3.0</span> <span style="color: #66cc66;">&#41;</span>, range<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0.2</span>, <span style="color: #cc66cc;">1.0</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> generate<span style="color: #66cc66;">&#40;</span> aStep:<span style="color: #0066CC;">Number</span>, pStep:<span style="color: #0066CC;">Number</span>, c:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_index = <span style="color: #cc66cc;">0</span>;
			angStep = aStep;
			posStep = pStep;
			curl = c;			
			<span style="color: #000000; font-weight: bold;">var</span> loc:Point = <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span> _index <span style="color: #66cc66;">&lt;</span> <span style="color: #0066CC;">LENGTH</span> <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				n += <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span>angStep - -angStep<span style="color: #66cc66;">&#41;</span> + -angStep;
				n <span style="color: #66cc66;">*</span>= <span style="color: #cc66cc;">0.9</span> + curl <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.1</span>;
				a += n;
				loc.<span style="color: #006600;">x</span> += <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> a <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> posStep;
				loc.<span style="color: #006600;">y</span> += <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> a <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> posStep;
				_posX<span style="color: #66cc66;">&#91;</span> _index <span style="color: #66cc66;">&#93;</span> = loc.<span style="color: #006600;">x</span>;
				_posY<span style="color: #66cc66;">&#91;</span> _index <span style="color: #66cc66;">&#93;</span> = loc.<span style="color: #006600;">y</span>;
				_index++;
			<span style="color: #66cc66;">&#125;</span>
			_index = <span style="color: #cc66cc;">0</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> step<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			_g.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			_g.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span>, 0x000000, <span style="color: #cc66cc;">0.7</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> c:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>;
			<span style="color: #000000; font-weight: bold;">var</span> radius:<span style="color: #0066CC;">Number</span>;
			<span style="color: #b1b100;">while</span><span style="color: #66cc66;">&#40;</span> c <span style="color: #66cc66;">&lt;</span> _index <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				radius = _index <span style="color: #66cc66;">/</span> c; 				
				<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> radius <span style="color: #66cc66;">&gt;</span> <span style="color: #cc66cc;">10</span> <span style="color: #66cc66;">&#41;</span> radius = <span style="color: #cc66cc;">10</span>;
				_g.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span> 0xFF6600, <span style="color: #cc66cc;">0.4</span> <span style="color: #66cc66;">&#41;</span>;
				_g.<span style="color: #006600;">drawCircle</span><span style="color: #66cc66;">&#40;</span> _posX<span style="color: #66cc66;">&#91;</span> c <span style="color: #66cc66;">&#93;</span>, _posY<span style="color: #66cc66;">&#91;</span> c <span style="color: #66cc66;">&#93;</span>, radius <span style="color: #66cc66;">&#41;</span>;
				_g.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				c++;
			<span style="color: #66cc66;">&#125;</span>
			_index++;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> _index <span style="color: #66cc66;">&gt;</span>= <span style="color: #0066CC;">LENGTH</span> <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #0066CC;">this</span>.<span style="color: #006600;">generate</span><span style="color: #66cc66;">&#40;</span> range<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0.01</span>, <span style="color: #cc66cc;">0.05</span> <span style="color: #66cc66;">&#41;</span>, range<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">2.0</span>, <span style="color: #cc66cc;">3.0</span> <span style="color: #66cc66;">&#41;</span>, range<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0.2</span>, <span style="color: #cc66cc;">1.0</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> range<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">min</span>:<span style="color: #0066CC;">Number</span>, <span style="color: #0066CC;">max</span>:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">NaN</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">isNaN</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">max</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">max</span> = <span style="color: #0066CC;">min</span>; <span style="color: #0066CC;">min</span> = <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#125;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #0066CC;">min</span> + <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">max</span> - <span style="color: #0066CC;">min</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>		
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.rickigregersen.com/2009/08/08/growing-homegrown-tentacles/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>RandomWalk</title>
		<link>http://www.rickigregersen.com/2009/08/06/randomwalk/</link>
		<comments>http://www.rickigregersen.com/2009/08/06/randomwalk/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 18:32:55 +0000</pubDate>
		<dc:creator>Ricki</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Particle]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[flash builder 4]]></category>

		<guid isPermaLink="false">http://www.rickigregersen.com/?p=180</guid>
		<description><![CDATA[Im looking into some of the random walk stuff out there and I stumbled upon www.actionsnippet.com and his RandomWalk experiments, great site by the way, bring coffee.
The thing that was cool about his way of doing it was that he constrains the &#8220;walkers&#8221; to only move: up, down, left and right. Absolutely no diagonal movement. [...]]]></description>
			<content:encoded><![CDATA[<p>Im looking into some of the random walk stuff out there and I stumbled upon <a href="http://www.actionsnippet.com">www.actionsnippet.com</a> and his RandomWalk experiments, great site by the way, bring coffee.<br />
The thing that was cool about his way of doing it was that he constrains the &#8220;walkers&#8221; to only move: up, down, left and right. Absolutely no diagonal movement. This produces a strange grid looking pattern.</p>
<p><object width="512" height="512" data="http://www.rickigregersen.com/wp-content/uploads/RandomWalk.swf" type="application/x-shockwave-flash"><param name="quality" value="high" /><param name="scale" value="exactfit" /><param name="salign" value="l" /><param name="wmode" value="transparent" /><param name="src" value="http://www.rickigregersen.com/wp-content/uploads/RandomWalk.swf" /></object></h4>
<p>The code:</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('p180code4'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p1804"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
</pre></td><td class="code" id="p180code4"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">//playing around with something Zevan Rosser from http://actionsnippet.com/?p=1236 did</span>
<span style="color: #808080; font-style: italic;">//on his blog</span>
&nbsp;
package <span style="color: #66cc66;">&#123;</span>
&nbsp;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #66cc66;">*</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #66cc66;">*</span>;
&nbsp;
	<span style="color: #66cc66;">&#91;</span>SWF<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;512&quot;</span>, <span style="color: #0066CC;">height</span> = <span style="color: #ff0000;">&quot;512&quot;</span>, <span style="color: #0066CC;">backgroundColor</span> = <span style="color: #ff0000;">&quot;0x222222&quot;</span>, frameRate = <span style="color: #ff0000;">&quot;120&quot;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> RandomWalk <span style="color: #0066CC;">extends</span> Sprite 
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _canvas:BitmapData;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _count:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">100</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _movers:Vector.<span style="color: #66cc66;">&lt;</span>Mover<span style="color: #66cc66;">&gt;</span>;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> RandomWalk<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> w:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">512</span>;
			<span style="color: #000000; font-weight: bold;">var</span> h:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">512</span>;
			scaleX=scaleY = <span style="color: #cc66cc;">0.25</span>;
			_canvas = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span> w <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">4</span>, h <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">4</span>, <span style="color: #000000; font-weight: bold;">false</span>, 0x222222 <span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span> _canvas <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			_movers = <span style="color: #000000; font-weight: bold;">new</span> Vector.<span style="color: #66cc66;">&lt;</span>Mover<span style="color: #66cc66;">&gt;</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> _count; i++ <span style="color: #66cc66;">&#41;</span> 
			<span style="color: #66cc66;">&#123;</span>
				_movers<span style="color: #66cc66;">&#91;</span> i <span style="color: #66cc66;">&#93;</span> = <span style="color: #000000; font-weight: bold;">new</span> Mover<span style="color: #66cc66;">&#40;</span> _canvas, w <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">1.5</span> + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> w, h <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">1.5</span> + <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> h <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			addEventListener<span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">ENTER_FRAME</span>, onRun <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> onRun<span style="color: #66cc66;">&#40;</span> evt:Event <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">200</span>; i++<span style="color: #66cc66;">&#41;</span> 
			<span style="color: #66cc66;">&#123;</span>
				<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> j:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; j <span style="color: #66cc66;">&lt;</span> _count; j++<span style="color: #66cc66;">&#41;</span> 
				<span style="color: #66cc66;">&#123;</span>
					_movers<span style="color: #66cc66;">&#91;</span> j <span style="color: #66cc66;">&#93;</span>.<span style="color: #006600;">run</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #66cc66;">&#125;</span>
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">BitmapData</span>;
<span style="color: #000000; font-weight: bold;">class</span> Mover 
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> x:<span style="color: #0066CC;">Number</span>;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> y:<span style="color: #0066CC;">Number</span>;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> velX:<span style="color: #0066CC;">Number</span>;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> velY:<span style="color: #0066CC;">Number</span>;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> speed:<span style="color: #0066CC;">Number</span>;
	<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _canvas:BitmapData;
	<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _color:uint;
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Mover<span style="color: #66cc66;">&#40;</span> canvas:BitmapData, xp:<span style="color: #0066CC;">Number</span>, yp:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#41;</span> 
	<span style="color: #66cc66;">&#123;</span>
		_color = 0xFF6600;<span style="color: #808080; font-style: italic;">//Math.random() * 0xFFFFFF;</span>
		_canvas = canvas;
		x = xp;
		y = yp;
		velX = <span style="color: #cc66cc;">0</span>;
		velY = <span style="color: #cc66cc;">0</span>;
		speed=<span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">5</span> - <span style="color: #cc66cc;">2.5</span>;
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> run<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> 
	<span style="color: #66cc66;">&#123;</span>
		x += velX;
		y += velY;
		_canvas.<span style="color: #006600;">setPixel</span><span style="color: #66cc66;">&#40;</span> x, y, _color <span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #000000; font-weight: bold;">var</span> dir:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">int</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">4</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>dir == <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span> 
		<span style="color: #66cc66;">&#123;</span>
			velX = <span style="color: #cc66cc;">0</span>;
			velY =- speed;
		<span style="color: #66cc66;">&#125;</span> 
		<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>dir == <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> 
		<span style="color: #66cc66;">&#123;</span>
			velX = <span style="color: #cc66cc;">0</span>;
			velY = speed;
		<span style="color: #66cc66;">&#125;</span> 
		<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>dir == <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span> 
		<span style="color: #66cc66;">&#123;</span>
			velX =- speed;
			velY = <span style="color: #cc66cc;">0</span>;
		<span style="color: #66cc66;">&#125;</span> 
		<span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>dir == <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> 
		<span style="color: #66cc66;">&#123;</span>
			velX = speed;
			velY = <span style="color: #cc66cc;">0</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.rickigregersen.com/2009/08/06/randomwalk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Homegrown Tentacles</title>
		<link>http://www.rickigregersen.com/2009/08/06/homegrown-tentacles/</link>
		<comments>http://www.rickigregersen.com/2009/08/06/homegrown-tentacles/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 18:03:40 +0000</pubDate>
		<dc:creator>Ricki</dc:creator>
				<category><![CDATA[ActionScript 3.0]]></category>
		<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Particle]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Bitmap]]></category>
		<category><![CDATA[Filters]]></category>
		<category><![CDATA[flash builder 4]]></category>
		<category><![CDATA[fun]]></category>

		<guid isPermaLink="false">http://www.rickigregersen.com/?p=173</guid>
		<description><![CDATA[I had been scurrying about over on the Soulwire blog, again, and looking at the tentacles. I did some experiments of
my own, but the tentacles never came out right, not organic enough. I wrote Justin and asked him how he did it and he was really cool about helping out with a code example of [...]]]></description>
			<content:encoded><![CDATA[<p>I had been scurrying about over on the Soulwire blog, again, and looking at the tentacles. I did some experiments of<br />
my own, but the tentacles never came out right, not organic enough. I wrote Justin and asked him how he did it and he was really cool about helping out with a code example of how he did that part.</p>
<p>The Soulwire Tentacles was an experiment in PixelBender speed and usability, so he makes it look as if the tentacles are really growing, i.e. starts out small and each &#8220;joint&#8221; grows as the tentacles grows. Mine is just a look into the random-organic way they grow. Also I was trying to see what kinds of speed I would get by using the Bitmap approach.</p>
<p>Here are the <a href="http://blog.soulwire.co.uk/flash/actionscript-3/pixel-bender-growing-tentacles/">Soulwire Tentacles</a></p>
<p>And here are my Tentacles&#8230; that came out wrong&#8230; <img src='http://www.rickigregersen.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><object width="512" height="512" data="http://www.rickigregersen.com/wp-content/uploads/BitmapSpore.swf" type="application/x-shockwave-flash"><param name="quality" value="high" /><param name="scale" value="exactfit" /><param name="salign" value="l" /><param name="wmode" value="transparent" /><param name="src" value="http://www.rickigregersen.com/wp-content/uploads/BitmapSpore.swf" /></object></h4>
<p>The code:</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('p173code6'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p1736"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
</pre></td><td class="code" id="p173code6"><pre class="actionscript" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/**
*
 * @BitmapSpore.as	:	inspired by http://blog.soulwire.co.uk/flash/actionscript-3/pixel-bender-growing-tentacles/
 * @Date  08/06-09
 * @Ricki Gregersen
*/</span>
&nbsp;
package
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Bitmap</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">BitmapData</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">filters</span>.<span style="color: #006600;">BlurFilter</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">ColorTransform</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Point</span>;
&nbsp;
	<span style="color: #66cc66;">&#91;</span>SWF<span style="color: #66cc66;">&#40;</span> <span style="color: #0066CC;">width</span>=<span style="color: #ff0000;">&quot;512&quot;</span>, <span style="color: #0066CC;">height</span> = <span style="color: #ff0000;">&quot;512&quot;</span>, <span style="color: #0066CC;">backgroundColor</span> = <span style="color: #ff0000;">&quot;0x222222&quot;</span>, frameRate = <span style="color: #ff0000;">&quot;30&quot;</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#93;</span>
&nbsp;
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> BitmapSpore <span style="color: #0066CC;">extends</span> Sprite
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> fading : ColorTransform = <span style="color: #000000; font-weight: bold;">new</span> ColorTransform<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">0.99999</span> <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #0066CC;">static</span> <span style="color: #000000; font-weight: bold;">var</span> _blur : BlurFilter = <span style="color: #000000; font-weight: bold;">new</span> BlurFilter<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">2</span> <span style="color: #66cc66;">&#41;</span>;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _bmd:BitmapData;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _bmp:Bitmap;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _container:Sprite;
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> BitmapSpore<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			_bmd = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">512</span>, <span style="color: #cc66cc;">512</span>, <span style="color: #000000; font-weight: bold;">true</span>, 0x222222 <span style="color: #66cc66;">&#41;</span>;
			_bmp = <span style="color: #000000; font-weight: bold;">new</span> Bitmap<span style="color: #66cc66;">&#40;</span> _bmd <span style="color: #66cc66;">&#41;</span>;
			addChild<span style="color: #66cc66;">&#40;</span> _bmp <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">var</span> s:Spore;
			addChild<span style="color: #66cc66;">&#40;</span> _container = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">500</span>; i++ <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				s = <span style="color: #000000; font-weight: bold;">new</span> Spore<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">256</span>, <span style="color: #cc66cc;">256</span>, range<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0.01</span>, <span style="color: #cc66cc;">0.05</span> <span style="color: #66cc66;">&#41;</span>, range<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">2.0</span>, <span style="color: #cc66cc;">3.0</span> <span style="color: #66cc66;">&#41;</span>, range<span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0.2</span>, <span style="color: #cc66cc;">1.0</span> <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
				s.<span style="color: #006600;">scaleX</span> = s.<span style="color: #006600;">scaleY</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">2</span>;
				_container.<span style="color: #006600;">addChild</span><span style="color: #66cc66;">&#40;</span> s <span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
			addEventListener<span style="color: #66cc66;">&#40;</span> Event.<span style="color: #006600;">ENTER_FRAME</span>, update <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> update<span style="color: #66cc66;">&#40;</span> event:Event <span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">int</span> = _container.<span style="color: #006600;">numChildren</span>;
			<span style="color: #000000; font-weight: bold;">var</span> s:Spore;
&nbsp;
			<span style="color: #b1b100;">for</span><span style="color: #66cc66;">&#40;</span> <span style="color: #000000; font-weight: bold;">var</span> i:<span style="color: #0066CC;">int</span> = <span style="color: #cc66cc;">0</span>; i <span style="color: #66cc66;">&lt;</span> n; i++ <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				s = Spore<span style="color: #66cc66;">&#40;</span> _container.<span style="color: #006600;">getChildAt</span><span style="color: #66cc66;">&#40;</span> i <span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
				s.<span style="color: #006600;">move</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				s.<span style="color: #006600;">x</span> = s.<span style="color: #006600;">loc</span>.<span style="color: #006600;">x</span>;
				s.<span style="color: #006600;">y</span> = s.<span style="color: #006600;">loc</span>.<span style="color: #006600;">y</span>;
			<span style="color: #66cc66;">&#125;</span>			
			_bmp.<span style="color: #006600;">filters</span> = <span style="color: #66cc66;">&#91;</span>  _blur <span style="color: #66cc66;">&#93;</span>;
			_bmd.<span style="color: #006600;">colorTransform</span><span style="color: #66cc66;">&#40;</span> _bmd.<span style="color: #006600;">rect</span>, fading <span style="color: #66cc66;">&#41;</span>; 			
			_bmd.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span> _container <span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> range<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">min</span>:<span style="color: #0066CC;">Number</span>, <span style="color: #0066CC;">max</span>:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">NaN</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">Number</span>
		<span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">isNaN</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">max</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><span style="color: #0066CC;">max</span> = <span style="color: #0066CC;">min</span>; <span style="color: #0066CC;">min</span> = <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#125;</span>
				<span style="color: #b1b100;">return</span> <span style="color: #0066CC;">min</span> + <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">max</span> - <span style="color: #0066CC;">min</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span> 
&nbsp;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Point</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Shape</span>;
&nbsp;
	<span style="color: #000000; font-weight: bold;">class</span> Spore <span style="color: #0066CC;">extends</span> Shape
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">var</span> loc:Point;
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> angStep:<span style="color: #0066CC;">Number</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> posStep:<span style="color: #0066CC;">Number</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> curl:<span style="color: #0066CC;">Number</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> n:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0</span>;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> a:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">2</span>;
&nbsp;
		<span style="color: #000000; font-weight: bold;">function</span> Spore<span style="color: #66cc66;">&#40;</span> xPos:<span style="color: #0066CC;">Number</span>, yPos:<span style="color: #0066CC;">Number</span>, aStep:<span style="color: #0066CC;">Number</span>, pStep:<span style="color: #0066CC;">Number</span>, c:<span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#41;</span>
		<span style="color: #66cc66;">&#123;</span>
			loc = <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span> xPos, yPos <span style="color: #66cc66;">&#41;</span>;
			angStep = aStep;
			posStep = pStep;
			curl = c;
			graphics.<span style="color: #0066CC;">lineStyle</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span>, 0x222222, <span style="color: #cc66cc;">0.7</span> <span style="color: #66cc66;">&#41;</span>;
			graphics.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span> 0xFF6600, <span style="color: #cc66cc;">0.7</span> <span style="color: #66cc66;">&#41;</span>;
			graphics.<span style="color: #006600;">drawCircle</span><span style="color: #66cc66;">&#40;</span> <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">5</span> <span style="color: #66cc66;">&#41;</span>;
			graphics.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;	
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> move<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
		<span style="color: #66cc66;">&#123;</span>
			n += <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #66cc66;">&#40;</span>angStep - -angStep<span style="color: #66cc66;">&#41;</span> + -angStep;
			n <span style="color: #66cc66;">*</span>= <span style="color: #cc66cc;">0.9</span> + curl <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">0.1</span>;
			a += n;
			loc.<span style="color: #006600;">x</span> += <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">cos</span><span style="color: #66cc66;">&#40;</span> a <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> posStep;
			loc.<span style="color: #006600;">y</span> += <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">sin</span><span style="color: #66cc66;">&#40;</span> a <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> posStep;			
			<span style="color: #0066CC;">this</span>.<span style="color: #006600;">scaleX</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">scaleY</span> <span style="color: #66cc66;">*</span>= <span style="color: #cc66cc;">0.98</span>;
			<span style="color: #000000; font-weight: bold;">var</span> s:<span style="color: #0066CC;">Number</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">scaleX</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">scaleY</span>;
			<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span> s <span style="color: #66cc66;">&lt;</span> <span style="color: #cc66cc;">0.1</span> <span style="color: #66cc66;">&#41;</span>
			<span style="color: #66cc66;">&#123;</span>
				loc.<span style="color: #006600;">x</span> = loc.<span style="color: #006600;">y</span> = <span style="color: #cc66cc;">256</span>;
				<span style="color: #0066CC;">this</span>.<span style="color: #006600;">scaleX</span> = <span style="color: #0066CC;">this</span>.<span style="color: #006600;">scaleY</span> = <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">random</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> <span style="color: #cc66cc;">2</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.rickigregersen.com/2009/08/06/homegrown-tentacles/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
