<?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>nooshu &#187; Canvas Archives </title>
	<atom:link href="http://nooshu.com/category/canvas/feed" rel="self" type="application/rss+xml" />
	<link>http://nooshu.com</link>
	<description>Kneeling on the shoulders of giants</description>
	<lastBuildDate>Sun, 15 Apr 2012 13:42:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>There ain&#8217;t no party like a DemoJS party</title>
		<link>http://nooshu.com/there-aint-no-party-like-a-demojs-party?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=there-aint-no-party-like-a-demojs-party</link>
		<comments>http://nooshu.com/there-aint-no-party-like-a-demojs-party#comments</comments>
		<pubDate>Wed, 06 Jul 2011 10:15:00 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1762</guid>
		<description><![CDATA[What can be more fun than some cutting edge web technology and a bunch of people who love to create interesting demos!]]></description>
			<content:encoded><![CDATA[<p>Another day, another website that makes my jaw drop to my desk. This time it&#8217;s the results from the latest <a href="http://demojs.org/" title="JavaScript fun!">Mozilla Labs DemoJS</a> party. Hosted in Paris, France over the weekend, it had many coders and artists attending hoping to win big prizes by creating interesting demo&#8217;s using the latest web technologies. I may not understand French but I&#8217;d have still attended just to see all the demos on show; some extremely inspiring coding going on.</p>
<p>The competition was split into two sections; 1k and freestyle. I find both interesting but as I&#8217;ve mentioned before in <a href="http://nooshu.com/1kjs-smaller-is-better" title="JS1k: Smaller is Better!">previous blog posts</a> I&#8217;m always amazed at what can be done with 1k of code.</p>
<p><iframe width="518" height="418" src="http://www.youtube.com/embed/B24bLKWIy-o?rel=0" frameborder="0" allowfullscreen></iframe></p>
<p>The video above is of a demo created by <a href="http://www.silexars.com/">Silexars</a> that came in second place. A live demo can be viewed <a href="http://demojs.org/2011/releases/1K/online/Silexars_-_Creation">here</a>. All created with less than 1k of code! WebGL really is starting to come of age. As with any of these demo&#8217;s it&#8217;s so easy to copy / paste, modify and learn from them. View source is a wonderful tool. </p>
<p>Another demo that caught my eye was by <a href="http://www.p01.org">p01</a> (who I&#8217;ve blogged about <a href="http://nooshu.com/p01-org-amazing-experiments-using-javascript" title="p01.org: Amazing Experiments using JavaScript">before</a>). This time he created <a href="http://www.p01.org/releases/gl1k_cotton_candy/">Quaternion Julia Fractal</a> in only 550 bytes of JavaScript and GLSL! It came in third place.</p>
<div id="attachment_1764" class="wp-caption alignnone" style="width: 528px"><a href="http://www.p01.org/releases/gl1k_cotton_candy/1k.htm"><img src="http://nooshu.com/wp-content/uploads/2011/07/p01-julia-518x294.jpg" alt="Quaternion Julia Fractal by p01" title="p01-julia" width="518" height="294" class="size-medium wp-image-1764" /></a><p class="wp-caption-text">All this possible in less that 1k of code.</p></div>
<p>From the freestyle section the <a href="http://demojs.org/2011/releases/Freestyle/online/basecode_-_Particles.js">Particles.js</a> by basecode has completely killed my productivity today! </p>
<p>Nice work guys and gals! If you have a spare few minutes (hours) check out the rest of the <a href="http://demojs.org/" title="JavaScript fun!">DemoJS</a> results, you won&#8217;t be disappointed.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/there-aint-no-party-like-a-demojs-party/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fun with Space Invaders and Parallax scrolling</title>
		<link>http://nooshu.com/fun-with-space-invaders-and-parallax-scrolling?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fun-with-space-invaders-and-parallax-scrolling</link>
		<comments>http://nooshu.com/fun-with-space-invaders-and-parallax-scrolling#comments</comments>
		<pubDate>Wed, 25 May 2011 23:25:47 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[aliens]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1723</guid>
		<description><![CDATA[Loving the HTML5 Canvas element. Having fun with the parallax effect and a few aliens.]]></description>
			<content:encoded><![CDATA[<p>Back when I was a young wippersnapper (many moons ago) one of my good friends had a <a href="http://en.wikipedia.org/wiki/Mega_Drive">Sega Mega Drive</a>. As with any new console it was on every kids Christmas list but compared to the current generation of games consoles it looks very primitive. The games were immense fun and you didn&#8217;t need an instruction manual to play them. Two of my favourite games were <a href="http://en.wikipedia.org/wiki/Golden_Axe">Golden Axe</a> and <a href="http://en.wikipedia.org/wiki/Sonic_the_Hedgehog_(video_game)">Sonic the Hedgehog</a>. Sonic the Hedgehog used a technique called <a href="http://en.wikipedia.org/wiki/Parallax_scrolling">Parallax scrolling</a>; this is where background images move slower than &#8220;closer&#8221; foreground images giving the illusion of depth in a 2D plane.</p>
<p>I&#8217;m quite late to the web parallax party as the effect was recreated and popularised back in 2008. I first remember seeing it being used by the holding page for Clearleft&#8217;s <a href="http://silverbackapp.com/">Silverback application</a>, but it may have appeared elsewhere before that. Three years on the web is a long time and technology has moved on, so I set myself a little project to recreate the effect using the HTML5 canvas element.</p>
<div id="attachment_1724" class="wp-caption alignnone" style="width: 528px"><a href="http://dl.dropbox.com/u/7851949/space-invaders/index.html"><img src="http://nooshu.com/wp-content/uploads/2011/05/space-invader-parallax.gif" alt="Parallax scrolling using a Space Invaders alien" title="space-invader-parallax" width="518" height="357" class="size-full wp-image-1724" /></a><p class="wp-caption-text">Move your mouse to see the Parallax scrolling effect.</p></div>
<p>To demonstrate the effect I used a few graphics from another iconic retro game: <a href="http://en.wikipedia.org/wiki/Space_Invaders">Space Invaders</a>. As you move the mouse the scary alien separates into its constituent pixels. The foreground pixels move faster than the background pixels creating a slight parallax effect. You have three aliens to choose from: Dave, Julian and Brian, which I&#8217;ve named for no particular reason. I think the names quite suit them. I&#8217;ve also added a little randomness to the demo in how they are generated, which you can see by reloading the page.</p>
<p>Hooray for retro games and <a href="http://dl.dropbox.com/u/7851949/space-invaders/index.html">pointless demo&#8217;s</a>! :) </p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/fun-with-space-invaders-and-parallax-scrolling/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating 3D trees with some #CreativeJS</title>
		<link>http://nooshu.com/creating-3d-trees-with-some-creativejs?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-3d-trees-with-some-creativejs</link>
		<comments>http://nooshu.com/creating-3d-trees-with-some-creativejs#comments</comments>
		<pubDate>Mon, 09 May 2011 15:15:06 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Three.js]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[three.js]]></category>
		<category><![CDATA[tree]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1654</guid>
		<description><![CDATA[Everyone love trees. What about a few virtual trees created using some JavaScript goodness?]]></description>
			<content:encoded><![CDATA[<div id="attachment_1655" class="wp-caption alignnone" style="width: 528px"><a href="http://dl.dropbox.com/u/7851949/treejs/index.html"><img src="http://nooshu.com/wp-content/uploads/2011/05/threejs-trees.gif" alt="Random trees created using three.js and some creative JavaScript" title="threejs-trees" width="518" height="449" class="size-full wp-image-1655" /></a><p class="wp-caption-text">Trees generated at random using some CreateiveJS and Three.js.</p></div>
<p>Over a month has passed since my last blog post and much has happened. We&#8217;ve had a wedding, a funeral at sea (maybe in bad taste!) and I&#8217;ve gone full-time freelance (yay!). I&#8217;ve had a little more time to work on a couple of personal projects so I&#8217;ve finished one that I started way back in January.</p>
<p>I had the pleasure of attending a <a href="http://sebleedelisle.com/2011/02/creativejs-experiments/">Creative JavaScript course</a> in Brighton, UK, hosted by <a href="http://sebleedelisle.com/">Seb Lee-Delisle</a>; a two-day course that covered a wealth of topics from Vanilla JavaScript to Three.js. If you&#8217;re looking for some inspiration I highly recommend looking out for one of Seb&#8217;s courses. Great fun and you get to meet some really nice people. <strong>Quick tip:</strong> You may want to brush up on a little <a href="http://en.wikipedia.org/wiki/Trigonometry">Trigonometry</a> before you go as it&#8217;s used numerous times. I knew that A-Level Mathematics course would come in useful one day :).</p>
<p>Seb produced a demo in Canvas that created &#8216;trees&#8217; and it really caught my eye. The trees were in 2D so as I&#8217;ve had a bit of experience with <a href="https://github.com/mrdoob/three.js/">Three.js</a> I decided to create a 3D version! I&#8217;m quite happy with the result although I&#8217;ve had to restrict the number of branches rendered due to the lack of dedicated graphics card in my laptop; I get about 1fps when stopping at a branch length value of 10 (line 211) :(</p>
<p><a href="http://dl.dropbox.com/u/7851949/treejs/index.html">The demo</a> also allowed me to use the new request animation frame API which vendors have added to aid animations in browsers. The main advantage of using it is if you have the animation running in a tab that isn&#8217;t visible, the browser will know to stop the animation! Using the old setTimeout method, the animation still runs in the background and uses up precious CPU, memory and battery power (especially on a laptop). As with most new browser features the API isn&#8217;t set in stone (yet) but luckily Paul Irish has <a href="http://paulirish.com/2011/requestanimationframe-for-smart-animating/">created a polyfill</a> that falls back to setTimeout in older browsers. </p>
<p>View the <a href="http://dl.dropbox.com/u/7851949/treejs/index.html">demo here</a>; reload for different trees. JavaScript finally seems to be coming of age!</p>
<p><strong>Update:</strong> Original credit goes to Jean-No with his <a href="http://www.openprocessing.org/portal/?userID=997">amazing OpenProcessing work</a>! I&#8217;ll be bookmarking that link, some stunning work there. Thanks to Seb for pointing out who to credit :)</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/creating-3d-trees-with-some-creativejs/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fractal magic with WebGL</title>
		<link>http://nooshu.com/fractal-magic-with-webgl?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fractal-magic-with-webgl</link>
		<comments>http://nooshu.com/fractal-magic-with-webgl#comments</comments>
		<pubDate>Wed, 16 Mar 2011 23:42:08 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[fractal]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[webgl]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1621</guid>
		<description><![CDATA[When you cross fractals with WebGL you're sure to catch my attention. Fractal Lab is a work of art!]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been so busy recently I haven&#8217;t had chance to work on any personal projects (bar a small amount of <a href="http://nodejs.org/">node.js</a>, but that&#8217;s a future blog post); so I thought I do a quick post on a very impressive project that caught my eye last week: <a href="http://fractal.io/">Fractal Lab</a>.</p>
<div id="attachment_1626" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2011/03/mathematical-worlds.jpg"><img src="http://nooshu.com/wp-content/uploads/2011/03/mathematical-worlds-518x438.jpg" alt="Fractal Lab interactive examples" title="mathematical-worlds" width="518" height="438" class="size-medium wp-image-1626" /></a><p class="wp-caption-text">Pure mathematical worlds generated using Fractal Lab</p></div>
<p>Fractal Lab, as the name suggests, is a fractal rendering tool using OpenGL Shading Language (GLSL) by a very talented programmer called <a href="http://www.subblue.com/about">Tom Beddard</a>. Now I&#8217;m not going to lie to you, the mathematics behind all this goes way over my head! OpenGL on the other hand is something I&#8217;ve read about with increasing frequency recently due to the WebGL explosion happening on the &#8216;net at the moment. Big thanks to all the developers of Firefox, Chrome (Webkit) and Opera for that! Internet Explorer 9 on the other hand <a href="http://learningwebgl.com/blog/?p=993">isn&#8217;t planning on supporting it</a>. Hopefully that will change in the future.</p>
<p>Fractal Lab allows you to render out 2D &#038; 3D fractals directly to your browser and navigate through them in real time! Be warned though, this will push your browser and graphics card really hard. It mentions this on the site; it&#8217;s possible to lock-up your GPU with certain GLSL fractal shaders, so be careful (my poor laptops on-board graphics card did exactly that, so he&#8217;s not lying) :)</p>
<p>There&#8217;s hours of fun and experimentation to be had with this superb example or WebGL. Thank you to Tom for developing it.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/fractal-magic-with-webgl/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The developing WebGL demoscene</title>
		<link>http://nooshu.com/the-developing-webgl-demoscene?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-developing-webgl-demoscene</link>
		<comments>http://nooshu.com/the-developing-webgl-demoscene#comments</comments>
		<pubDate>Mon, 07 Mar 2011 00:36:43 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[demoscene]]></category>
		<category><![CDATA[webgl]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1614</guid>
		<description><![CDATA[Cool graphics in the browser, the demoscene has woken up to WebGL. Bring on the amazing demos!]]></description>
			<content:encoded><![CDATA[<p>One of my key memories from playing a friends <a href="http://en.wikipedia.org/wiki/Amiga">Amiga</a> oh so many years ago (apart from <a href="http://en.wikipedia.org/wiki/Cannon_Fodder">Cannon Fodder</a>) is the cool intro demos created by the <a href="http://www.scene.org/">demoscene</a>. These were usually found on, <em>cough</em>, slightly dodgy versions of games that were &#8220;acquired&#8221; from various sources :)</p>
<p>What&#8217;s always amazed me about these demos is the amount of space the programmers had to play with and the hardware available at the time; both extremely limited. While the space and hardware limitations are no longer an issue, people are still developing these amazing demos. One reason for this is due to an exciting area in Web Development that&#8217;s currently flourishing: <a href="http://en.wikipedia.org/wiki/WebGL">WebGL</a>. The <a href="http://www.khronos.org/news/press/releases/khronos-releases-final-webgl-1.0-specification">technical specification</a> was finalised last week and developers have started to take notice of this very powerful visual programming language. Developing demos in the browser environment is a new limitation and programmers are looking at WebGL to push the boundaries.</p>
<div id="attachment_1616" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2011/03/full-webgl-demo.jpg"><img src="http://nooshu.com/wp-content/uploads/2011/03/full-webgl-demo-518x518.jpg" alt="The demoscene in action via WebGL" title="full-webgl-demo" width="518" height="518" class="size-medium wp-image-1616" /></a><p class="wp-caption-text">WebGL port of &quot;glass&quot;, an old 64kb demo from 2000. </p></div>
<p>The <a href="http://possan.se/junk/webglass/index.html">demo above</a> has been converted into WebGL by a very talented programmer called <a href="http://possan.se/">Per-Olov Jernberg</a> (Possan). You can even take a look at the <a href="https://github.com/possan/webglass">source on Github</a> if your that way inclined! You can view the original from April 2000 <a href="http://pouet.net/prod.php?which=94">here</a>.</p>
<p>With modern browsers like Chrome, Firefox 4 and <a href="http://my.opera.com/chooseopera/blog/2011/03/03/a-sneak-preview-of-our-upcoming-webgl-demo">now Opera</a> adding WebGL support and improving their JavaScript engines, there&#8217;s never been a better time for Web Developers to get involved in this new demoscene. All that&#8217;s needed is some JavaScript, Canvas and a little creativity. I genuinely look forward to seeing all the old school programmers diving into WebGL. I personally know very little about this new language so I&#8217;ll be able to learn so much by doing a quick &#8220;view source&#8221;.</p>
<p>There&#8217;s already a WebGL competition in progress called <a href="http://gl64k.com/">gl64k</a> where programmers have to create an interesting visual demo with only 64k (65,536 bytes) at their disposal. Awesome stuff will be emerging from this new technology in the next couple of years and I for one can&#8217;t wait to see what!</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/the-developing-webgl-demoscene/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Fractalmaps</title>
		<link>http://nooshu.com/google-fractalmaps?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=google-fractalmaps</link>
		<comments>http://nooshu.com/google-fractalmaps#comments</comments>
		<pubDate>Tue, 01 Feb 2011 23:13:53 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[cool]]></category>
		<category><![CDATA[fractal]]></category>
		<category><![CDATA[maths]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1598</guid>
		<description><![CDATA[Google Labs hard at work on a particular interest of mine, fractal rendering.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been a fan of Google for quite a while now. What with their superb Chrome browser, Gmail service, <a href="http://code.google.com/intl/fr-FR/more/table/">extensive API&#8217;s</a> and most importantly their motto, &#8220;Don&#8217;t be evil&#8221;; what&#8217;s not to like! Only time will tell on the last point so fingers crossed. While browsing the <a href="http://googleresearch.blogspot.com/">Google Research Blog</a> I spotted a very interesting article: <a href="http://googleresearch.blogspot.com/2011/01/julia-meets-html-5.html">Julia Meets HTML5</a>.</p>
<div id="attachment_1601" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2011/02/julia-map.jpg"><img src="http://nooshu.com/wp-content/uploads/2011/02/julia-map-518x518.jpg" alt="" title="julia-map" width="518" height="518" class="size-medium wp-image-1601" /></a><p class="wp-caption-text">The Julia Map with a random colour scheme (nice feature).</p></div>
<p>Julia of course refers to Julia fractals rather than a person called Julia. Named after <a href="http://en.wikipedia.org/wiki/Gaston_Julia">Gaston Julia</a>, a French mathematician who studied them in the 1920&#8242;s. His works were largely forgotten until Benoît Mandelbrot mentioned them in his now famous works on fractals.</p>
<p>Google Labs have created an extremely slick way of navigating around various types of fractals. From the plain old boring(!), Mandelbrot and it&#8217;s many variations to the Julia and Newton fractal. Select a fractal and colour scheme then zoom and drag just like a standard Google Map. </p>
<p>According to the article the demo uses the Google Maps API; I guess it may use it loosely in it&#8217;s user interface but there are an infinite number of zoom levels with fractals. When you zoom into a coastline on a Google Maps you will eventually reach a limit where you will be presented with a fuzzy image (or a blank tile); this will never happen on the Julia Map. The &#8217;tile&#8217; information isn&#8217;t downloaded from a server like Google Maps, it&#8217;s calculated on the fly by the browsers JavaScript engine. The faster the JavaScript Engine the better. If you have a browser that supports the new Web Workers API you will notice a huge difference in performance, as the CPU intensive fractal calculation will be offloaded to separate worker threads rather than the single main UI thread.</p>
<p>I could spend hours investigating the infinite mathematical landscape of the Julia Map, why not <a href="http://juliamap.googlelabs.com/#ll=0,0&#038;z=0&#038;p=0,ff0000&#038;f=mandelbrot">try it out for yourself</a> and post your results on Twitter under hashtag #juliamap.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/google-fractalmaps/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual thesaurus using arbor.js</title>
		<link>http://nooshu.com/visual-thesaurus-using-arbor-js?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=visual-thesaurus-using-arbor-js</link>
		<comments>http://nooshu.com/visual-thesaurus-using-arbor-js#comments</comments>
		<pubDate>Sun, 30 Jan 2011 19:30:40 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[words]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1587</guid>
		<description><![CDATA[Arbor.js is a very impressive graph visualisation library that takes advantage of jQuery and the Web Workers API. I make my own version of the Visual Thesaurus with it.]]></description>
			<content:encoded><![CDATA[<p>Wow, I can&#8217;t believe we are at the end of January &#8211; one twelfth of the year gone already! I&#8217;ve been so busy this month I&#8217;ve barely had time to sit down and work on any personal projects. Thankfully I had a spare few hours over the weekend to work on  a project I&#8217;ve been meaning to finish for a couple of weeks: <a href="http://nooshu.com/explore/arbor-visual-thesaurus/">a visual thesaurus using JavaScript</a>.</p>
<div id="attachment_1588" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2011/01/visual-thesaurus.gif"><img src="http://nooshu.com/wp-content/uploads/2011/01/visual-thesaurus.gif" alt="Visual Thesaurus using JavaScript" title="visual-thesaurus" width="518" height="350" class="size-full wp-image-1588" /></a><p class="wp-caption-text">Visual thesaurus representation of the word 'clean'.</p></div>
<p>You may (or may not) know of the <a href="http://www.visualthesaurus.com/">Visual Thesaurus by Thinkmap</a>; very useful but it&#8217;s a paid for service, I use it so infrequently I can&#8217;t justify paying for it (there is a free trial though). Recently a very interesting graph visualisation library popped up on <a href="http://www.delicious.com/">delicious</a> called <a href="http://arborjs.org/">arbor.js</a>, so I decided to have a closer look and see if I could use it for the JavaScript version. For the word data I&#8217;ve used the <a href="http://words.bighugelabs.com/api.php">Bighugelabs thesaurus API</a> which I previously used to create my <a href="http://nooshu.com/wordpress-plug-in-post-thesaurus/">Post Thesaurus</a> WordPress plug-in (shameless plug!).</p>
<p>Arbor.js took a little getting used to as it uses a mixture jQuery, canvas and its own methods; but there&#8217;s a fairly extensive set of documentation and a set of usage examples. Once you get your head around adding nodes and edges to the system, arbor takes care of the rest. One thing I did notice is the site examples and my VT experiment run much smoother in Firefox than they do in Chrome, which is quite surprising considering how quick the V8 engine is in Chrome. Maybe this will be improved in future versions.</p>
<p>So to the <a href="http://nooshu.com/explore/arbor-visual-thesaurus/">demo</a>; I&#8217;ve tried to keep it very simple to use. Enter the word you wish to visualise and click search. Once the API returns a result it&#8217;s plotted by arbor. You can drill down into the result by clicking on the sub-particles (and remove them by clicking again). The individual words can be clicked and you&#8217;re given the option to search again using the selected word. I still haven&#8217;t got the perfect system setup as some results can be a little jittery; usually when an even set of words are returned. I&#8217;ll keep playing with system settings to see if I can improve this.</p>
<p>Any suggestions, comments or feature improvements please leave a comment below!</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/visual-thesaurus-using-arbor-js/feed</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>Nasty Canvas Image Data Error</title>
		<link>http://nooshu.com/nasty-canvas-image-data-error?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nasty-canvas-image-data-error</link>
		<comments>http://nooshu.com/nasty-canvas-image-data-error#comments</comments>
		<pubDate>Tue, 23 Nov 2010 09:39:46 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[image]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1493</guid>
		<description><![CDATA[Revisited an old experiment that looks to have been broken for a while. Luckily it was a quick fix.]]></description>
			<content:encoded><![CDATA[<p>Last night I decided to revisit an experiment I wrote earlier in the year: <a href="http://nooshu.com/using-image-data-inside-the-html5-canvas-element/">Using Image Data Inside the HTML5 Canvas Element</a>. It involved loading 2 &#8211; 3 images and swapping out the image data depending on the mouse position. I ran into a slight issue though, it wasn&#8217;t working:</p>
<div class="codecolorer-container text default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">uncaught exception: [Exception... &quot;Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIDOMCanvasRenderingContext2D.drawImage]&quot; &nbsp;nsresult: &quot;0x80040111 (NS_ERROR_NOT_AVAILABLE)&quot; &nbsp;location: &quot;JS frame :: http://nooshu.com/explore/canvas-image-data/js/ci.js :: anonymous :: line 27&quot; &nbsp;data: no]</div></td></tr></tbody></table></div>
<p>Not good! I double checked the code on my local machine and it worked. Very odd! I noticed that it wasn&#8217;t working when you first hit the page but was on page reload. Then it struck me; it must be a caching issue. I was correct.</p>
<p>It turns out that the JavaScript was firing before all the images had fully loaded.</p>
<div class="codecolorer-container javascript default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">context.<span style="color: #660066;">drawImage</span><span style="color: #009900;">&#40;</span>lakeImage<span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #003366; font-weight: bold;">var</span> originalLakeImageData <span style="color: #339933;">=</span> context.<span style="color: #660066;">getImageData</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> iWidth<span style="color: #339933;">,</span> iHeight<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>The above lines were trying to access ImageData that didn&#8217;t exist yet and the browser was falling over because of it. Doh! Luckily I&#8217;d used jQuery for a couple of functions in the experiment so I quickly wrapped the code in a load method, problem solved!</p>
<div class="codecolorer-container javascript default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span>window<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">load</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #006600; font-style: italic;">//Your code here</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>This method waits until the whole page has loaded (including images) before the code inside it is fired, guaranteeing the image data is there to be manipulated when needed. <a href="http://nooshu.com/explore/canvas-image-data/">View the updated demo</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/nasty-canvas-image-data-error/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Three.js and the Audio Data API Visualisation</title>
		<link>http://nooshu.com/three-js-and-the-audio-data-api-visualisation?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=three-js-and-the-audio-data-api-visualisation</link>
		<comments>http://nooshu.com/three-js-and-the-audio-data-api-visualisation#comments</comments>
		<pubDate>Mon, 15 Nov 2010 13:18:12 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[visualisations]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1468</guid>
		<description><![CDATA[I've played with the HTML5 Audio Data API in the past for 2D visualisations. So how about some 3D?]]></description>
			<content:encoded><![CDATA[<div id="attachment_1471" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/11/full.gif"><img src="http://nooshu.com/wp-content/uploads/2010/11/full-518x359.gif" alt="3D audio visualisation" title="full" width="518" height="359" class="size-medium wp-image-1471" /></a><p class="wp-caption-text">Mr Doob has created a superb JavaScript 3D Engine in three.js. Screenshots from my 'Bowl' demo.</p></div>
<p>I&#8217;ve been watching the development of <a href="https://github.com/mrdoob/three.js/">three.js</a> by <a href="http://mrdoob.com/">Mr Doob</a> for a couple of months and have been desperate to experiment with it. With Firefox 4 well into the <a href="http://www.mozilla.com/en-GB/firefox/beta/">beta stage</a> I decided to bite the bullet and do a little Audio Data visualisation in 3D!</p>
<p>I&#8217;ve <a href="http://nooshu.com/audio-visualisation-using-html5-and-canvas/">dabbled with audio visualisation</a> and the <a href="https://wiki.mozilla.org/Audio_Data_API">HTML5 Audio Data API</a> in the past, so I&#8217;m pleased I&#8217;ve had a chance to use it again and see what&#8217;s new. <strong>Note</strong>: My previous audio visualisations using canvas no longer work due to specification changes in the API. A pitfall of using an API that&#8217;s still in the draft stages I guess.</p>
<p>I&#8217;ve put together 5 simple demo&#8217;s all based around the same theme showing some of the options available in three.js. My favourite is &#8220;bowl&#8221;, pretty colours galore!</p>
<ul>
<li><strong><a href="http://nooshu.com/explore/threejs-visualisation/circle/">Circle</a></strong>: Simple circle, zoom in / out using the mouse wheel.</li>
<li><strong><a href="http://nooshu.com/explore/threejs-visualisation/cubes/">Cubes</a></strong>: Same as circle only using the cube primitive.</li>
<li><strong><a href="http://nooshu.com/explore/threejs-visualisation/cylinder/">Cylinder</a></strong>: Using the cylinder primitive with a floating camera.</li>
<li><strong><a href="http://nooshu.com/explore/threejs-visualisation/sinewave/">Sinewave</a></strong>: Rotated sinewave (looks a little like a chandelier).</li>
<li><strong><a href="http://nooshu.com/explore/threejs-visualisation/bowl/">Bowl</a></strong>: A combination of the above demos to create an interesting 3D bowl effect.</li>
</ul>
<p>Please note these demos will <strong>only work in <a href="http://www.mozilla.com/firefox/beta/">Firefox 4</a></strong>. The Audio Data API is still a draft specification and Mozilla is the only browser vendor to have added it to date. I&#8217;m looking forward to it being added to Chrome (Webkit), with its superb V8 JavaScript engine. The demo&#8217;s really are just the tip of the iceberg for both three.js and the Audio Data API. It&#8217;s certainly an area of the HTML5 specification to keep your eye on. </p>
<p>The music track used in the visualisation is called &#8220;Sad Robot&#8221; by a group called &#8220;Pornophonique&#8221;. Very catchy tune that you can <a href="http://www.jamendo.com/en/track/81740">download from Jamendo</a>.</p>
<p><strong>Update</strong>: It looks like enabling the Google Page Speed Apache module seems to have broken the demos. I&#8217;ve disabled it now so it should hopefully fix it (fingers crossed!).</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/three-js-and-the-audio-data-api-visualisation/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>JS1k: We have a winner!</title>
		<link>http://nooshu.com/js1k-we-have-a-winner?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=js1k-we-have-a-winner</link>
		<comments>http://nooshu.com/js1k-we-have-a-winner#comments</comments>
		<pubDate>Mon, 27 Sep 2010 20:28:54 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Canvas]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JS1k]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1389</guid>
		<description><![CDATA[Looking at the winners of the JS1k competition I really can't see how some of the entries have been produced! 1024 bytes goes a long way in JavaScript.]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve been following my blog posts over the past couple of months you will have seen <a href="http://js1k.com/home">JS1k</a> being mentioned quite a few times. If not the idea is simple; create something cool with JavaScript using only 1024 bytes. Now you may think that you can&#8217;t do much with 1Kb, but you&#8217;d be wrong! Just take a look at the 1st place entry:</p>
<div id="attachment_1391" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/09/js1k-winner-image.gif"><img src="http://nooshu.com/wp-content/uploads/2010/09/js1k-winner-image-518x97.gif" alt="JS1k winner image using canvas" title="js1k-winner-image" width="518" height="97" class="size-medium wp-image-1391" /></a><p class="wp-caption-text">All this with 1024 bytes of JavaScript? That's crazy talk!</p></div>
<p>The author <a href="http://marijn.haverbeke.nl/js1k.html">Marijn Haverbeke</a> has created a very cool little platform game that&#8217;s actually very playable. As you jump from block to block and move through the level to collect the gold coins, the game gets progressively harder. How exactly did he do that I hear you ask; well using this code of course:</p>
<div class="codecolorer-container javascript default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">c<span style="color: #339933;">=</span>document.<span style="color: #660066;">body</span>.<span style="color: #660066;">children</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>h<span style="color: #339933;">=</span>t<span style="color: #339933;">=</span><span style="color: #CC0000;">150</span><span style="color: #339933;">;</span>L<span style="color: #339933;">=</span>w<span style="color: #339933;">=</span>c.<span style="color: #660066;">width</span><span style="color: #339933;">=</span><span style="color: #CC0000;">800</span><span style="color: #339933;">;</span>u<span style="color: #339933;">=</span>D<span style="color: #339933;">=</span><span style="color: #CC0000;">50</span><span style="color: #339933;">;</span>H<span style="color: #339933;">=</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>R<span style="color: #339933;">=</span>Math.<span style="color: #660066;">random</span><span style="color: #339933;">;</span>for<span style="color: #009900;">&#40;</span>$ <span style="color: #000066; font-weight: bold;">in</span> C<span style="color: #339933;">=</span><br />
c.<span style="color: #660066;">getContext</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'2d'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>C<span style="color: #009900;">&#91;</span>$<span style="color: #009900;">&#91;</span>J<span style="color: #339933;">=</span>X<span style="color: #339933;">=</span>Y<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">+</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">6</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">||</span><span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span>C<span style="color: #009900;">&#91;</span>$<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>setInterval<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;if(D)for(x=405,i=y=I=0;i&lt;1e4;)L=<span style="color: #000099; font-weight: bold;">\</span><br />
H[i++]=i&lt;9|L&lt;w&amp;R()&lt;.3?w:R()*u+80|0;$=++t%99-u;$=$*$/8+20;y+=Y;x+=y-H[(x+X)/u|0]&gt;9?0:X;j=H[o=<span style="color: #000099; font-weight: bold;">\</span><br />
x/u|0];Y=y&lt;j|Y&lt;0?Y+1:(y=j,J?-10:0);with(C){A=function(c,x,y,r){r&amp;&amp;a(x,y,r,0,7,0);fillStyle=c.P<span style="color: #000099; font-weight: bold;">\</span><br />
?c:'#'+'ceff99ff78f86eeaaffffd45333'.substr(c*3,3);f();ba()};for(D=Z=0;Z&lt;21;Z++){Z&lt;7&amp;&amp;A(Z%6,w/<span style="color: #000099; font-weight: bold;">\</span><br />
2,235,Z?250-15*Z:w);i=o-5+Z;S=x-i*u;B=S&gt;9&amp;S&lt;41;ta(u-S,0);G=cL(0,T=H[i],0,T+9);T%6||(A(2,25,T-7<span style="color: #000099; font-weight: bold;">\</span><br />
,5),y^j||B&amp;&amp;(H[i]-=.1,I++));G.P=G.addColorStop;G.P(0,i%7?'#7e3':(i^o||y^T||(y=H[i]+=$/99),<span style="color: #000099; font-weight: bold;">\</span><br />
'#c7a'<span style="color: #000099; font-weight: bold;">\)</span>);G.P(1,'#ca6');i%4&amp;&amp;A(6,t/2%200,9,i%2?27:33);m(-6,h);qt(-6,T,3,T);l(47,T);qt(56,T,56,<span style="color: #000099; font-weight: bold;">\</span><br />
h);A(G);i%3?0:T&lt;w?(A(G,33,T-15,10),fc(31,T-7,4,9)):(A(7,25,$,9),A(G,25,$,5),fc(24,$,2,h),D=B&amp;y<span style="color: #000099; font-weight: bold;">\</span><br />
&gt;$-9?1:D);ta(S-u,0)}A(6,u,y-9,11);A(5,M=u+X*.7,Q=y-9+Y/5,8);A(8,M,Q,5);fx(I+'¢',5,15)}D=y&gt;h?1:D&quot;</span><br />
<span style="color: #339933;">,</span>u<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>onkeydown<span style="color: #339933;">=</span>onkeyup<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>E<span style="color: #339933;">=</span>e.<span style="color: #660066;">type</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">5</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">?</span><span style="color: #CC0000;">4</span><span style="color: #339933;">:</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>e<span style="color: #339933;">=</span>e.<span style="color: #660066;">keyCode</span><span style="color: #339933;">;</span>J<span style="color: #339933;">=</span>e<span style="color: #339933;">^</span><span style="color: #CC0000;">38</span><span style="color: #339933;">?</span>J<span style="color: #339933;">:</span>E<span style="color: #339933;">;</span>X<span style="color: #339933;">=</span>e<span style="color: #339933;">^</span><span style="color: #CC0000;">37</span><span style="color: #339933;">?</span>e<span style="color: #339933;">^</span><span style="color: #CC0000;">39</span><span style="color: #339933;">?</span>X<span style="color: #339933;">:</span>E<span style="color: #339933;">:-</span>E<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>See, simple&#8230; urghh! That&#8217;s the minified source code so it won&#8217;t make much sense, but Marijn has been kind enough to post the unminified code for everyone to look at in a <a href="http://marijn.haverbeke.nl/js1k.html">blog post</a> about the entry. Very impressive! I&#8217;ll be taking a close look at the source when I get some spare time. Many congratulations to Marijn, superb work.</p>
<p>There are 10 winners in total listed on the JS1k page, all equally impressive, but here are my 5 personal favourites:</p>
<ul>
<li><strong><a href="http://js1k.com/demo/224">3D Snowman</a></strong> by <a href="http://twitter.com/romancortes">romancortes</a></li>
<li><strong><a href="http://js1k.com/demo/644">Mandelbrot with Colours</a></strong> by <a href="http://stack.hu/">Gabor Turi</a></li>
<li><strong><a href="http://js1k.com/demo/450">Colourful Visualisation</a></strong> by <a href="http://benalman.com/">&#8220;Cowboy&#8221; Ben Alman</a></li>
<li><strong><a href="http://js1k.com/demo/699">Tiny Chess</a></strong> by <a href="http://nanochess.110mb.com/">Óscar Toledo</a></li>
<li><strong><a href="http://js1k.com/demo/15">Wobbling Tunnel</a></strong> by <a href="http://marcinignac.com/">Marcin Ignac</a></li>
</ul>
<p>Some excellent submissions there, I sure you&#8217;d agree. Take a look at all the submissions on the <a href="http://js1k.com/demos">JS1k demo page</a>. </p>
<p>I&#8217;d like to say a big thank you to <a href="http://qfox.nl/">Peter van der Zee</a> for creating the JS1k competition, I&#8217;ve really enjoyed it. I&#8217;m already looking forward to next year. On a side note, just imagine what&#8217;s possible with 2048 bytes!</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/js1k-we-have-a-winner/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

