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 .
Mouse 1D
by REAS <http://reas.com>
Move the mouse left and right to shift the balance.
The "mouseX" variable is used to control both the
size and color of the rectangles.
Updated 16 September 2002
int gx = 15;
int gy = 35;
float leftColor = 0.0;
float rightColor = 0.0;
void setup()
{
size(200, 200);
colorMode(RGB, 1.0);
noStroke();
}
void draw()
{
background(0.0);
update(mouseX);
fill(0.0, leftColor + 0.4, leftColor + 0.6);
rect(width/4-gx, width/2-gx, gx*2, gx*2);
fill(0.0, rightColor + 0.2, rightColor + 0.4);
rect(width/1.33-gy, width/2-gy, gy*2, gy*2);
}
void update(int x)
{
leftColor = -0.002 * x/2 + 0.06;
rightColor = 0.002 * x/2 + 0.06;
gx = x/2;
gy = 100-x/2;
if (gx < 10) {
gx = 10;
} else if (gx > 90) {
gx = 90;
}
if (gy > 90) {
gy = 90;
} else if (gy < 10) {
gy = 10;
}
}