Learn creative coding writing simple programs
79. A spinning star becomes a plant
This is the third time we modify our 3D rotating cube. The first time it contained floating points. The second version contained lines pointing from the center in many different directions. It looked like a star. This third version uses bezier curves, and hopefully it looks a little bit like a plant. All our curves begin at the bottom of the cube, right in the middle of the floor, and they all continue straight up because the first control point is at the middle of the ceiling of the cube. The end point is somewhere random inside the cube. To simplify things, we avoid thinking of an original second control point for each curve. We just reuse the end point as second control point.
Don't worry if you don't understand yet the X, Y and Z axes, it can be confusing at the beginning. We will study them with more detail in the future.
Code editor
background
bezier
draw
for
height
int
map
mouseX
new
noFill
point
random
rotateY
setup
size
smooth
stroke
strokeWeight
translate
TWO_PI
void
width
Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)
To indicate that a word in your comment is code, use the `backtick`. Example
Do `float` and `int` smell similar?
To highlight code blocks, surround it with ``` code-fences ``` like this:``` void setup() { size(600, 600); } ```