Nature of code — particle systems

EG
2 min readFeb 25, 2020

--

One of the assignment’s options for this week was to rewrite some code that I have written earlier. I chose my ‘Introduction to computational media” midterm project.

First of all, because it has some nice background story, that is important to me.

Second, I feel like this code has a lot to rearrange. I still remember the face of my professor when she saw all those hard-coded numbers. Back then, the task was to practice functions, which I did, and now I bet this is the weirdest example of function-oriented programming ever (if it even is, which I doubt, because it’s really just an object-oriented program written in an outdated manner by a person who wasn’t taking any math-related classes except for ICM at the time).

Anyways, here is the old version of the code in p5.js web editor. Basically it’s a game where a user “catches” the rabbit with the mouse and get the fortune-telling. Everything is moving pretty fast and crazy but that was done intentionally at the time.

The code looks pretty intimidating.

However, that’s obviously A LOT to improve with different particles system. It’s not only about rabbits and the blinking dots. I was thinking of creating particle systems for different parts of rabbit’s bodies to create more interesting behaviors and patterns, and also about working the same way with all the fortune-tellings (and adding new ones).

However, for now, I started with rewriting classes for the rabbits and the blinking stars. I had one intermediary result which I kind of love for its weirdness and scary vibes.

Rearranged code is here — https://editor.p5js.org/eglazkova/sketches/3ArCwha7

And, more or less, final version (as crazy as the original) — HERE.

However, I am seriously thinking of taking this very code for my 2-weeks assignment. The goals are to work with text and with rabbit’s bodies, the speed of their movement and add more interaction. I am also thinking of working with some APIs, so that fortune-tellings could be data-based.

--

--