Statements and Comments
Coordinates
Width and Height
Setup and Draw
No Loop
Loop
Redraw
Functions
Recursion
Recursion 2
Objects
Points and Lines
Shape Primitives
Curve Primitives
Vertices
Simple Curves
Variables
Integers and Floats
True/False
Array
Array 2D
Array Objects
Characters and Strings
Datatype Conversion
Variable Scope
Iteration
Embedded Iteration
Conditionals 1
Conditionals 2
Logical Operators
Increment/Decrement
Modulo
Operator Precedence
Distance 1D
Distance 2D
Sine
Sine and Cosine
Additive Wave
Arctangent
Graphing 2D Equation
Koch
Madelbrot
Random
Noise 1D
Noise 2D
Noise 3D
NoiseWave
Polar to Cartesian
Continuous Lines
Pattern
Custom Tool
Letters
Words
Displaying
Background Image
Brightness
Pointillism
Histogram
Pixel Array
Linear Image
Transparency
Convolution
Edge Detection
Blur
Sequential
Sprite
Animated Sprite
Alphamask
Hue
Saturation
Brightness
Reading
Creating
Relativity
Translate
Scale
Rotate
Linear
Bounce
Nonlinear
Moving On Curves
Brownian Motion
Collision
Mouse 1D
Mouse 2D
Click
Mouse Signals
Interpolate
Constrain
Storing Input
Mouse Functions
Keyboard
Keyboard Functions
Milliseconds
Rollover
Button
Buttons
Image Button
Handles
Scrollbar
Spring
Springs
Cellular Automata 1 (Life)
Cellular Automata 2
Cellular Automata 3
Wolfram CA
Tree
Fluid
Smoke
Simple Particle System
Multiple Particle Systems
Smoke Particle System
Primitives 3D
Vertices
RGB Cube
Translate 3D
Rotate 3D
Push and Pop
Embedding Push and Pop
Extrusion
Zoom
Explode
Letter K
Kinetic Type
Typing
Lights
Directional
Spot
Ortho
Perspective
Ortho vs. Perpective
MoviePlayback
Pixelate
WebCam
Mirror
Mirror2
Brightness Tracking
ValueClient
ValueServer
HTTP Client
Chat Server
Binary input
Analog input
Call / Response
Duplex
Matrix
Examples for Processing (BETA) version 91+. If you have a previous version, use the examples included with your software. If you see any errors or have comments, please let us know .
Zoom
by REAS <http://reas.com>
Move the cursor over the image to alter its position. Click and press
the mouse to zoom and set the density of the matrix by typing numbers 1-5.
This program displays a series of lines with their heights corresponding to
a color value read from an image.
Created 10 August 2002
PImage a;
boolean onetime = true;
int[][] aPixels;
float sval = 1.0;
float nmx, nmy;
int res = 5;
void setup()
{
size(200, 200, P3D);
noFill();
stroke(255);
aPixels = new int[width][height];
a = loadImage("ystone08.jpg");
for(int i=0; i<height; i++) {
for(int j=0; j<width; j++) {
aPixels[j][i] = a.pixels[i*width+j];
}
}
}
void draw()
{
background(51);
if (abs(mouseX - nmx) > 1.0) {
nmx = nmx + (mouseX-nmx)/20;
}
if (abs(mouseY - nmy) > 1.0) {
nmy += (mouseY-nmy)/20;
}
if(mousePressed) {
sval += 0.005;
} else {
sval -= 0.01;
}
if(sval > 2.5) { sval = 2.5; }
if(sval < 1.0) { sval = 1.0; }
translate(width/2+nmx*sval-100, height/2+nmy*sval-100, -50);
scale(sval);
rotateZ(PI/9-sval+1.0);
rotateX(PI/sval/8-0.125);
rotateY(sval/8-0.125);
translate(-width/2, -height/2, 0);
float rr, gg, bb, tt;
for(int i=0; i<height; i+=res) {
for(int j=0; j<width; j+=res) {
rr = red(aPixels[j][i]);
gg = green(aPixels[j][i]);
bb = blue(aPixels[j][i]);
tt = rr+gg+bb;
stroke(rr, gg, gg);
line(i, j, tt/10-20, i, j, tt/10 );
}
}
}
void keyPressed() {
if(key == '1') {
res = 1;
} else if (key == '2') {
res = 2;
} else if (key == '3') {
res = 3;
} else if (key == '4') {
res = 4;
} else if (key == '5') {
res = 5;
}
}