1 of 16

Processing.js

A quick tutorial by fabiola

2 of 16

Why?

3 of 16

What is processing.js ?

Let's look at processing first!

4 of 16

Processing

  1. Programming Language
  2. Development Environment
  3. Online Community

5 of 16

Why do I like it?

  • Great teaching tool
  • Open source
  • Active community
  • So many external libraries
  • It produces beautiful results

6 of 16

Demo Processing, please!

7 of 16

Processing.js

- Processing ported to browser

- makes use of HTML5 Canvas Element

- data visualizations, digital art, interactive animations, educational graphs, video games...

- runs in FireFox, Safari, Chrome, Opera, and Internet Explorer.

8 of 16

Let's see some examples!

Marius Watz's Abstract.js

Bezier Curves Explained

Josh Nimoy's Ball Droppings

Simon Last's Paintbrush, TweetWeather

A lot more, here:

http://processingjs.org/exhibition/

9 of 16

What does the code look like?

Two options:

1st Method: 2nd Method:

Needed Files: Needed Files:

1. processing.js 1. processing.js

2. anything.html 2. anything.html

3. anything.pde

10 of 16

The anything.html file will look like:

<script src="processing.js"></script> �<canvas data-processing-sources="anything.pde"></canvas>�

The anything.pde file will look like:

void setup()�{� size(200,200);� background(125);� fill(255);� noLoop();� PFont fontA = loadFont("courier");� textFont(fontA, 14); �}�void draw(){ � text("Hello Web!",20,20);� println("Hello ErrorLog!");�}

11 of 16

In the second method the anything.html file will look like:

<script src="processing.js"></script>�<script type="text/processing" data-processing-target="mycanvas">�

void setup(){� size(200,200);� background(125);� fill(255);� noLoop();� PFont fontA = loadFont("courier");� textFont(fontA, 14); �}�void draw(){ � text("Hello Web!",20,20);� println("Hello ErrorLog!");�}�</script>�<canvas id="mycanvas"></canvas>

12 of 16

Let's try it!

13 of 16

Final note

Processing.js is not the only web-drawing tool

Two main competitors:

- Paper.js

- Raphaël

14 of 16

Web Drawing Tool Comparison

Paper.js

Processing.js

Raphaël

Technology

canvas tag

canvas tag

SVG

Language

PaperScript

Processing script

JavaScript

Browsers

IE 9

IE 9

IE 7

Mobile

Yes

Yes

iOS only

Model

Vector and raster

Raster

Vector

Size

56 KB

64 KB

20 KB

15 of 16

For a more in-depth comparison

http://zgrossbart.github.com/3gears/

16 of 16

Questions?

if you want to try this out and have questions, feel free to email me: fhanna@ucsc.edu