Some of my experiments

Hi! :slight_smile: 12 days ago I started uploading one sketch per day from my ideas folder. I do that while having breakfast every morning.

Some will be more visual, others will be less so (testing data structures, performance… more boring stuff). Still, maybe there’s something useful in there.

If you want to be notified you can click watch in this repo.

Here the first ones.


A simple class that allows showing a larger PGraphics in a smaller viewport, pan and zoom using the mouse.

This sketch shows 6 such viewports running simultaneously.


A sketch that draws a huge number of lines of various lengths and colors all starting from the same position is space. These images were all created with this program by slightly changing the formula.


Modified Line Shader giving it variable width. Note that it only used ellipse to draw circles.


Generate animated flowers when pressing the space key. Press s to save an image.


Testing the Voronoi class from Toxiclibs.

The program creates a voronoi triangle mesh on every animation frame based on 20 points moved by the noise() function.

Then it uses the triangles from that mesh to draw translucent lines and points without clearing the screen which results in a somewhat organic morphing shape.


Simple rings painted with circles.

Trying to have objects that are simultaneously in front and behind others, as by default objects are either in front or behind.


In the Processing forum it was asked how to call a method by name. Here’s one example using reflection.


A basic example of how to get all color hues without using the HSB mode. The variable t sets the hue. Then R, G and B are calculated based on t by using the sin() function.


Program that draws glowing curves quantized to 6 possible angles, producing hexagonal shapes.


Slowly rotating 3D cubes painting on a black background. A black translucent line connecting the two cubes compensates by subtracting light from the result.


Painting program. Loads random images from two folders (please configure) to act as textures for painting strokes.
The brush size modulates with time.

How I use it: I paint a stroke, if I don’t like it, press ‘u’ to undo,
try again. Get into the rhythm. Wait until the stroke paints thin or thick. Observe. Press [SPACE] to change paint colors. Embrace the unpredictable.


Drawing lines of variable stroke-weight with a shader.

The shader is mostly the original line shader from Processing with just two little changes: one to make the line width variable, and another to modulate the color so it doesn’t look flat.


Painting with the color of lights instead of using fill colors.

The reason to do that is to achieve more depth by painting with gradients instead of flat colors.

Light positions rotate smoothly but with regular jumps to create colors patterns in the drawn cubes.


I really like the spinningCubeRainbow. I look at the code and it seems so simple.
I wonder how you do that. You visualize in your mind first or is it with experimenting.

Thank you, I’m glad you like it :slight_smile:

In this particular case I don’t remember how I got the idea, as it was 2 years ago.

I guess most of the times I have an idea in my mind. It can be a mathematical idea, or a concept based on something I see around me (plants, birds or a stain in the ground, a texture…). Maybe I don’t know exactly how it will look like in advance, but I have something I want to try. Sometimes it can be just a random constrain like “do something with cubes”.

Later I may iterate based on what I see and add things, remove them if they don’t work, mix them with old sketches… In the end I guess each time it’s different :slight_smile:


Last uploads…


Noise field. A typical effect is sampling a noise field by using the current pixel coordinates then interpreting the obtained value as an angle to move to a nearby pixel, and keep repeating that operation. The resulting image resembles somewhat roots or branches: lines that converge.

In this case I repeat the process twice, the second time inverting the displacement sign. So for the starting point I obtain two lines instead of one, and they go in exactly opposing directions. The difference is that it looks less like branches or roots because one can not see the beginning of those branches or roots. It’s like connecting the branches of two trees together, each branch connecting with a branch in the other tree.

Try changing the sigmoid value between 0.0 and 1.0 for different looks.


A simple method to create a ring-shaped PShape.


Draws circles with a bump. The bump is located at an angle defined by the variable high . The width of the bump is defined by overlap , which is modulated over time to make it more dynamic, while using an offset so not all circles are wide or narrow at the same time, but in sequence instead.


Simple shader-based generative texture applied to a rotating 3D cube.


Choose a random point in the screen and start drawing a line there. If you are going to collide with an existing line or with the border of the window, turn to avoid that. If there’s no way to avoid collision, respawn somewhere else and try again.


Creates a 3D grid of cubes of different sizes with two possible colors and exports it to .obj format for rendering in Blender.


Shows how to work with an animated 3D layer with transparent background which can be displayed multiple times.


A method to draw an animated noise-bent line between two points.

Also shows how to create a square using polar coordinates. That is, how to get the radius of a square for any given angle.