-
Random Circles
This is a small sketch that helps us understand the potential of the random() function and one can start using randomness in their work quickly. size(600,600); smooth(); int circleNum = 50; noStroke(); for (int i = 0; i<= circleNum; i += 1) { fill(random(255), random(255), random(255), random(255)); ellipse(random(width), random(height), random(width), random(width); } Next is an…
-
Randomness
It’s arguable that all generative art includes some degree of randomness: without randomness, there can be no unpredictability. Almost all programming languages include a function equivalent to Processing’s random function, but returning a truly random number is an impossibility for a predictable machine. Computer-generated randomness is always pseudo-random, using mathematical formulae, often including a reference to…
-
Datatyping
You might have noticed something else that’s new about the active mode structure of a sketch, that being the usage of the void keyword preceding both the setup() and draw() functions. The keyword void is used for defining functions that do not return a value, all other user defined functions must return a value of…
-
Experimentation
The setup() function must always precede the draw() function, and is used to define the initial properties of the sketch such as the size of the sketch. The size() function when used within an active mode sketch must always follow the setup() function before any other statements. If we had images to display in our…
-
Structure, Logic & Animation
Until now our scripts have been nothing more than a short list of instructions to perform, after which they stop. But with anything beyond the most basic level of programming, we will need to go further and group instructions and provide some decisions. It’s time to step it up a notch. The Frame Loop The…
-
function
A function is a way of chunking a group of commands together into a block of instruction that can be referenced by another part of your program.
-
Editing the smile
Our smile drawn with the arc() function looks fine but needs a bit of work. Although you cannot see it the arc actually has a fill. In order to see the fill we will first have to remove or hide the ellipse, but we’re happy with the way the ellipse looks so instead of deleting…
-
Aliasing
You might have noticed that the ellipse is looking a bit pixelated and not very smooth this effect is known as aliasing and is often counteracted with the effect of anti-aliasing which creates the impression of a smoother looking rendering. Fortunately in Processing we have a function that is made exactly for the purpose of…
-
Hello World 1.2
Processing is a language that was made to create visual representations of your code really easily, and as a result the developers of Processing have provided us with pre-configured functions for drawing primitive shapes much like you would expect in a drawing program. Shapes such as rectangles, ellipses and triangles amongst others are known as…
-
Formatting Text
You might have noticed that the text is supposed to be in the center of the Display Window but looks more like it’s leaning to the right hand side of the window. Processing allows us to align text relative to the coordinates we specified for the text() function’s X and Y parameters. The relative positions…