
<?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>Cory Schires &#187; Processing.js</title>
	<atom:link href="http://coryschires.com/tag/processing-js/feed/" rel="self" type="application/rss+xml" />
	<link>http://coryschires.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 14 Feb 2012 22:45:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>First few hours with processing.js.</title>
		<link>http://coryschires.com/first-few-hours-with-processing-js/</link>
		<comments>http://coryschires.com/first-few-hours-with-processing-js/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 05:57:06 +0000</pubDate>
		<dc:creator>Cory Schires</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Processing.js]]></category>

		<guid isPermaLink="false">http://coryschires.com/?p=296</guid>
		<description><![CDATA[I finally had a chance to check out processing. This language seems to have a lot potential for creating things that would be difficult or impossible with plain javascript...]]></description>
			<content:encoded><![CDATA[<p>I finally had a chance to check out processing. This language seems to have a lot potential for creating things that would be difficult or impossible with plain javascript:</p>
<div class="processing_canvas">
    <canvas datasrc="http://coryschires.com/wp-content/themes/cs-simple/processing/colorful_circle.pjs"></canvas>
</div>
<h3>What is processing.js?</h3>
<p>Processing is an easy-to-learn, open-source programming language for making images, animation, and interactions. Think of it like Flash but without all the nonsense. <a href="http://ejohn.org/" class="new_window">John Resig</a> recently ported the language over to javascript for use on the web. The result &mdash; <a href="http://processingjs.org/">processing.js</a> &mdash; uses javascript to draw shapes and manipulate images on the HTML5 Canvas element.</p>
<h3>How does it work?</h3>
<h4><span>1</span> Download the latest version of processing.js.</h4>
<p>You can download the latest stable release <a href="http://processingjs.org/download">here</a>. The package will contain a few files. First, the processing library which you&#8217;ll need to include in your header like any other javascript library:</p>
<div class="code_block">
<pre class="brush: ruby;">
        &lt;script src="processing-0.4.js"&gt;&lt;/script&gt;
    </pre>
</div>
<p>Next, an example.pjs file. This is where you&#8217;ll write your actual processing code. You&#8217;ll need need to reference this file somewhere in the body of your webpage: </p>
<div class="code_block">
<pre class="brush: ruby;">
        &lt;canvas datasrc="example.pjs"&gt;&lt;/canvas&gt;
    </pre>
</div>
<h4><span>2</span> Create a setup() block to hold your basic configuration logic.</h4>
<p>A <span class="code_text">setup()</span> block holds your basic configuration logic (i.e. the stuff you want to happen one time when the file is loaded). A simple <span class="code_text">setup()</span> block might look like this:</p>
<div class="code_block">
<pre class="brush: java;">
        void setup() {
        	size(255,255);
        	background(224); // light gray
        }
    </pre>
</div>
<h4><span>3</span> And create a draw() block to manage your animation.</h4>
<p>You place your animation code inside a <span class="code_text">draw()</span> block. This code will run as a continuous loop. This means it can be response to interactions, such as mouse position. This little block, for example, will draw a thin black line based on mouse position:</p>
<div class="code_block">
<pre class="brush: java;">
        void draw() {
        	// set line color to black
        	stroke(0);
        	// draw line between previous and new mouse coordinates
        	line(pmouseX,pmouseY, mouseX,mouseY);
        }
    </pre>
</div>
<h3>Where can I learn more?</h3>
<p>There are not many processing.js specific resources. But don&#8217;t worry. Both processing.js and the standard processing language use the same java-like syntax. This means you can freely mix-n-match resources from either project.</p>
<p>With that in mind, here&#8217;s a few leads:</p>
<ul>
<li>
        The <a href="http://processingjs.org/">processing.js homepage</a> has an excellent <a href="http://processingjs.org/learning">learning section</a> as well as a fairly extensive <a href="http://processingjs.org/reference">reference library</a>.
    </li>
<li>
        Casey Reas and Ben Fry, the creators of processing were nice enough to write a book. It&#8217;s available from the MIT press: <a href="http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&#038;tid=11251">Processing: A Programming Handbook for Visual Designers and Artists</a>
    </li>
<li>
        You might also checkout <a href="http://www.learningprocessing.com/">Learning Processing</a>. It&#8217;s a little easier to work through &mdash; especially if you&#8217;re new to programming.
    </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://coryschires.com/first-few-hours-with-processing-js/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

