<?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"
	>

<channel>
	<title>webroo.org &#187; Javascript</title>
	<atom:link href="http://webroo.org/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://webroo.org</link>
	<description>Matt Sweetman :: Flex &#38; Actionscript Development</description>
	<pubDate>Sun, 17 Jan 2010 18:24:02 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>HTML 5 Canvas vs Flash</title>
		<link>http://webroo.org/2010/01/17/html-5-canvas-vs-flash/</link>
		<comments>http://webroo.org/2010/01/17/html-5-canvas-vs-flash/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 16:11:26 +0000</pubDate>
		<dc:creator>Matt Sweetman</dc:creator>
		
		<category><![CDATA[Actionscript]]></category>

		<category><![CDATA[Flash]]></category>

		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://webroo.org/?p=136</guid>
		<description><![CDATA[Over the holidays I gave myself a break from Actionscript and took a look at the HTML 5 Canvas object. It&#8217;s been a while since I programmed any javascript, and AJAX technologies seem to be the popular choice for web apps these days (goodbye Flex!). I decided to port over an old Actionscript 1 experiment [...]]]></description>
			<content:encoded><![CDATA[<p>Over the holidays I gave myself a break from Actionscript and took a look at the HTML 5 Canvas object. It&#8217;s been a while since I programmed any javascript, and AJAX technologies seem to be the popular choice for web apps these days (goodbye Flex!). I decided to port over an old Actionscript 1 experiment to see how the two technologies performed alongside each other, the results can be seen below.</p>
<p><img src="http://webroo.org/images/snow1.jpg" width="130" height="130" alt="Snowfall image" /><a href="http://webroo.org/media/snowfall/canvassnowfall.html">Canvas Snowfall</a></p>
<p><a href="http://webroo.org/media/snowfall/flashsnowfall.html">Flash Snowfall</a></p>
<p>You&#8217;ll need a modern browser to view the canvas version (eg: Firefox/Chrome/Opera/etc). View the source of the Canvas version for the javascript.</p>
<p>As you can see they look pretty much identical, the differences primarily lie in performance. The Flash version can handle more than twice the number of snowflakes before the frame rate drops. This may be down to the a fundamental difference between Canvas and Flash: Canvas is a rasterised bitmap object, whereas Flash is a vector animation tool. When you draw shapes in Canvas you&#8217;re drawing directly onto a bitmap, the shape can no longer be moved or scaled and is &#8216;baked&#8217; into the image. In some ways it&#8217;s similar to the BitmapData object in Flash. Because of this animation is far easier to accomplish in Flash and I had to adapt parts of the original code to work with the Canvas concept.</p>
<p><span id="more-136"></span>Javascript and AS1 share a lot in similarity as programming languages so porting the code was relatively easy. The Canvas object also has a similar API to the Graphics object in Flash. I&#8217;ll admit Javascript is not my favourite language, by a long shot, the lack of strict typing is difficult to return to after years of AS3, and in more complex scripts nested closures can get messy. It is however fast to program, which can come in very handy when prototyping and experimenting with ideas.</p>
<p>It may be worth investigating <a href="http://processingjs.org/">Processing</a>, a framework for the Canvas object written by John Resig, the guy behind JQuery.</p>
]]></content:encoded>
			<wfw:commentRss>http://webroo.org/2010/01/17/html-5-canvas-vs-flash/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
