ImageButtonExample didn't really cater for doing something useful when you press a button. ImageButtonExample02 includes functionality to allow passing objects to invoke an activate() method on, with a parameter, so each button can have a different behaviour.
The rollover behaviour of the ImageButton example (that comes with Processing) sucks (eg shows the "down" state when mouse pressed _outside_ the button then dragged over the button). Here is a replacement.
From Processing Discourse:
How to use image data for motion?
CONTROLS
[s]obel image toggle
[n]ew ball (at centre of winodw)
[1]-[5] select processing mode (incresing optimisation)
[MOUSE CLICK] to position ball at mouse cursor
Demonstration of use of PImage.mask() to paint images with transparent parts. This sketch doesn't seem to behave nicely as an applet possibly due to loading 30 images (using requestImage()) in setup(). ("Out of heap space")
CONTROLS
[SPACE] toggle paused
[TAB] toggle ("debug") panel
[1234567] random image for layer 1-7
[qwertyu] random mask for layer 1-7
[asdfghj] toggle active state for layer 1-7
[+]/[-] increase/decrease number of layers in use
The above keyboard commands can all be achieved by mouse position and clicking:
- right click for pause
- click near bottom of mask t
A GUI knob that allows multiple revolutions.
PRESS SPACE FOR EXCITEMENT! :o)
v02 Features:
- Knob automation
- Selected / adjusting / automating colors
- Some keyboard control
Link to previous version:
spxlSuperKnob
A GUI knob that allows multiple revolutions.
Features:
- Rotation limited to specified number of revolutions in each direction
- Revolutions marker with graduated colour indicator
- Snap to full revolutions (visual cue: changed marker colours)
- Plays well with other knobs (ie doesn't hog mouseDragged())
- Resizable.
Inspired by
discussion on Processing Discourse forums.
Link to next version:
spxlSuperKnob02
spxlTextTrail
2010-02-14 by subpixel
http://subpixels.com
- Use offscreen PGraphics object to render smoke trail
- Demonstrate different blend() modes
CONTROLS
[r]andom change, [R]andomise all, next [b]lend mode, [n]ext message, [N] first message
TOGGLES
[SPACE] pause, [d]ebug/info, [a]uto changes, [T]rail, te[X]t, [C]ircle, [i]mage, [p]attern blend, [P]ure blend, [w]indowed trail
RANDOM
[t]rail blend factor, [B]lend mode, [/] pattern, [f]ont, [m]essage, te[x]t colour, [c]ircle colour
Mouse click: blend factor by mouse-X
spxlIris v01
2010-02-14 by subpixel
Audio reactive (using minim.getLineIn)
Likely will not react to audio as an applet
Controls:
[MouseX] scale
[UP/DOWN] increase/decrease opacity
[f] toggle flip (quads or bow-ties)
2010-02-12 by subpixel
http://subpixels.com
Demonstrate converting mouse location into item index without having to specifically remember individual item locations.
Click once to select.
Click a second time to launch http:// link.
1) Determine intersection of line through ellipse centre and arbitrary point with ellipse boundary.
2) Determine whether an arbitrary point is inside or outside the ellipse, or on the ellipse boundary.
Controls: Click and drag to relocate and resize the ellipse.
Example code demonstrating use of "direct buffers" (java.nio.ByteBuffer, java.nio.IntBuffer) with some timing code for comparing methods of taking "slices" of the pixels[] array.
All the "interesting" stuff is in the code, and/or displayed as debug output to the console.
The shapes on the screen are merely a distraction! :o)
Keyboard input similar to Photoshop controls (for layer opacity and other things requiring a % value).
"1" -> 10
"2" -> 20
"9" -> 90
"0" -> 100
"01" -> 1
"10" -> 10
"23" -> 23
"99" -> 99
"00" -> 100
A delay of more than 400ms (see variable entrySeparation) between keystrokes allows you to press "1" to mean "10" followed shortly after (but not too shortly) by "2" to mean "20".
Installed Processing on a different machine, and ran Ira Greenberg's BrickTower example to test it. I then got to poking at the Cube class, starting by reducing the number of PVertex objects created, and later revisiting a question I'd previously asked myself about using a TRIANGLE_STRIP to construct a cube. Yes, it can be done, and by specifying just 14 vertices instead of specifying 24 vertices with the QUADS method. By renumbering the vertices, a familiar-looking pattern can be made with the 8 cube-vertex coordinates: 000, 001, 010, 011, ... 111. Look's kinda "binary" to me! :o)
Utility sketch written to work out how to wrap a cube with a TRIANGLE_STRIP without overlaps.
Keys:
1-8: add numbered vertex to order of vertices rendered using TRIANGLE_FAN
BACKSPACE: remove last vertex from ordering
p: print (see console) current order
Code massage in response to a
Processing.org Discourse post.
Probably won't load any web feeds as an (unsigned) applet - just making the code available.
Evolution of
Open Moco InterfaceBuild_v002_001, recoded in an event-driven way.
Keyboard input as well as mouse; toggle active; toggle display; numeric/non-numeric text field; displays "0" instead of blank (numeric field only); Windows-like button interaction; Ctrl_click functionality; field sized based on font + padding; text display overflow limited; button layout based on loaded image sizes; WidgetLayout class to arrange buttons; more inside!
http://subpixels.com
Simulate saving money in a bank account, with regular (weekly and/or fortnightly) deposits, interest calculated daily and credited monthly, and monthly and/or annual fees.
Download or copy the code to change the values to suit your own investment schedule. :o)
Note: This is only a simple simulation and always uses 28 days in February (else some visual kludge is needed).
-spxl
Conway's Game of Life
by
subpixel
Version 1.3.2, 2009-08-26
Originally based on Conway by Mike Davis
~240% performance
New cells are bright; dead cells have a reduced saturation and brightness.
Controls:
SPACE/right-click - toggle pause
click/drag - add cells
[f]ade on/off
[n]ew world (empty)
[g]rid world
[a]dd random cell
[d]elete (kill) random cell
[1234567890] - "heat" world
[qwertyuiop] - "cool" world
2009-03-11 by subpixel
subpixels.com
Based on the fabulous
Origami Butterfly by
Kyle McDonald with various optimisations giving around a 3x speed improvement for realtime animation! The last fold is animated over time and reactive to mouse movement.
Keys:
[space] pause
[1]-[5] select source image
[f]old the paper again
[e]xtras
2009-03-10 by subpixel
subpixels.com
Keys:
[space] pause
[a]uto mode on/off
[up/down] +/- number of spikes
[right/left] +/- number of sides for each spike
"Summer of Rage" is a convenient term used by the media/government to paint any activities labeled with it, collectively, in a bad light.
Don't fall for it.
summerofrage.info
Quick and dirty "white noise" implementation using custom pseudorandom number generator that is around 30 times faster than using color(random(255), random(255), random(255)).
Virtual Playhead and Motion Blur Demo
"Perfectly Synching Hamster Gyro"
Code remix by
subpxiel
Version 0.2, 2009-01-29
Idea started with
Hamster Gyro Music Video Generator by Johan Larsby
Please download the zip file and run in the PDE (the applet dies for some reason).
[space] pause; [q]uit; [r]ewind to start; [s]ave on/off; [t]ime info; [LEFT][RIGHT] time skip -/+2 seconds; [,][.] frame step back/forward; "[" "]" decrease/increase play speed, [p]lay (1x speed); [-][+] decrease/increase targe
Conway's Game of Life
by
subpixel
Version 1.1, 2008-12-31
Based on Conway by Mike Davis
Updated version on site for book Enfoldment and Infinity: An Islamic Genealogy of New Media Art.
Perturbing the Infinite
New cells are bright; dead cells have a reduced saturation and brightness.
CONTROLS
Mouse click/drag - add cell/s
[space] - pause
[n]ew world (empty)
[g]rid (stable)
[a]dd a cell
[d]elete (kill) a cell
[1234567890] - add some cells
[qwertyuiop] - kill some cells
SpaceBoxes_by_spxl
by
subpixel
Version 1.2.1, 2009-01-24
Original idea and code ased on Falling Box by takumi
Keys:
[space] pause,
[1]..[8] random action on channel;
(shift)+[1]..[8] disable channel;
[a]uto bg on/off;
[b]background on/off;
[n]ext background image;
[e]ffect shot (2 seconds);
[E]ffect on/off;
[r]egular/random blocks;
[t]umble;
[w]obble;
[PGUP][PGDWN] rotation;
[,][.][/] halve/double/toggle speed;
[<][>][?] decrease/increase/reset speed.