This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.


by subpixel

Last modified: 2009-01-09 10:47

Experiments in graphics using PGraphics layers to construct an image.

I like the idea of having artificial "construction lines" optionally appear in an image, similar to showing a "wireframe" on a 3D model. This example uses two layers of construction lines: one behind the objects, and one in front of the objects. The level of detail can also be adjusted; in this case, the crosshairs to the edge of the window are at a higher level (not to be confused with higher layer!) than the small "+" to mark a circle's centre and a circle's outline.

The base Shape class includes details for presentation (fill colour, edge colour, edge weight, etc) as well as position and animation (in this case simple velocity with acceleration), including drawing a "trace" of the shape's location. The motion calculations aren't "reality-accurate", but they are time based, not frame based. To demonstrate this, you can increase and decrease the sketch's frame rate and see that the objects seem to move in similar trajectories whether the updates are regular (eg at 32 fps) or infrequent (eg at 1 fps). Time is "stopped" (or more like skipped) when the sketch is paused.

Another neat trick implemented is seamless wrapping of objects at the edges of the window. This is achieved by drawing an object multiple times, if required, offset by the window width and/or height. A similar trick is used to wrap the trace line generated for the shape.


Source code: Layers_by_spxl Circle Shape Vector2D

Built with Processing