VertexShape - Recursion
In the code below, we define a Recursive function: recursivePattern()
that creates repeated versions of the vertexPattern.
parameter: float length - size of the pattern
parameter: float level - controls number of repeats - insures termination
recursivePattern() defines the repetition structure
vertexPattern( ) is the task that is repeated
vertexShape( float len) function
recursivePattern( float length, float level ) function
Program using recursivePattern function
HSB Colormode - Set Fill at the Vertex Level - Shader Option
Once a design has been developed using grayscale color values as show above, then it's very easy using HSB colormode to add hueValues. Processing using P2D mode as specified in the size( 600,600, P2D) supports vertex shaders, where gradient colors are computed for fill( ) values specified between vertex for PShape objects.
Vertex Shading Example
The image above uses fill variation between each vertex, as shown above, to create enhanced depth for the pattern.
If we use the processing P2D rendering context, we can set a different fill value and stroke value for each vertex, this allows us to create visual depth in the pattern. When incorporated into a simple recursive function this can create interesting complex images. P2D might not work on some computers, if not, then just use regular: size(600,600);. You will need to create an interesting pattern using fill outside of the beginShape() function that impacts the entire shape.
Framecount as a timer - Option
We can use frameCount and modulus, to add a timer to the draw loop and (we can also rotate the pattern each time it is drawn using a similar technique)
Last updated
Was this helpful?