In week 3, we learned arrays, functions, and object-oriented programming. Originally, I was trying to make Tetris because the concept was tied to using arrays and OOP. During practice, I encountered an error with my box() function, where the console referred to a built-in p5js box() function.
I became curious and decided to check out the reference pages. It turns out that the box() function generates a three-dimensional shape box using WEBGL. After some testing and playing around, I decided that I wanted to make a geometric shape using these simple shapes.
The concept is inspired by Ramiel from the popular show, Evangelion, a diamond-shaped being. Using rotation functions, I can achieve this look.
Ramiel. Evangelion 1.0 you are (not) alone.
I also experimented with sin and cosine functions that resulted in a particular pattern using texts for the background. I tried implementing a way to change the direction of the text wave, but it was more difficult than I imagined so I scraped the idea.
Mouse click to add more cubes, BACKSPACE to remove one.
The best part of the code that I liked is the pulsing effect for the cube using a very simple sin function. Overall, the project was fun and a challenging one that I enjoyed while experimenting with p5js.
display(){ var pulse = this.size + sin(this.theta*1) * this.pulseAmplitude; fill(0, this.objColor, 200); box(pulse); this.theta += 0.13; }
References & Tutorials
p5.js Web Editor | Circle Pulse (p5js.org)