computational media – week 5

function RainbowTriangle (transX, transY)

This week I learned how to create functions and objects and how it can be applied to create repetitions and modulations. The code that I chose to do it was kind of tricky because some parts of the variables I used to create it, needed to be defined in the setup function, some in the draw, and some outside both, so I’m not sure if I organized it in the best way. Find the code here. Therefore, I’ll try to do it in another code I created before – the Rainbow Creature.

Ps: finally I got to create a rainbow gradient animation. To do so, I used colorMode(HSB) and a simple variable which goes up to 360 and turn into 0 again:

if (a >= 360) {
a = 0;
}
fill(a, 120, 180);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: