top of page
Search

Repetition 2

Updated: Jul 16, 2020

I started reading the assignment and realized that maybe it was time to do another tutorial marathon. I was having trouble, because I wanted to kind of group the elements to my corona in order to muliply them. This is what I learned:



What I learned from the tutorials:

What IS void? When the function has no return type, you say void!

A function that has a return type gives something back (like for example random funtion). Void performs a task, does not give you anything in return.


The function that I want to define has to be outside of draw and setup. It is usually located bellow thoes funtions, never inside.


vertex = verticles!


Dot Syntax = for example b.display

The Assignment


I decided to try and multiply the corona virus as described in the assignment:

What I did was first make the bodies of the coronas. Then the little dots were smaller ellipses places randomly. This looks funny, but I want to make one function for the corona virus and the multiply that, so that the virus always looks the same. Besides, I think it will be a very good excercise. This look too messy and not really like the virus I originally intended.


Here is the next try:



float x;

float y;


float body = 100;

float arms1 = 20;

float arms2 = 12;


void setup() {

size(800,800);

background(255);

scale(0.5);

for(int x=100; x<1600; x=x+200){

for(int y=100; y<1600; y=y+200){

//body of corona

stroke(255,115,0);

strokeWeight(2);

fill(255, 115, 0);

ellipse(x,y,body,body);

// corona arms, there are two different sizes, so I just switched between the two of them

stroke(185,20,0);

strokeWeight(2);

fill(255,60,0);

ellipse(x,y,arms1,arms1);

ellipse(x-25,y-15,arms2,arms2);

ellipse(x-35,y+27,arms1,arms1);

ellipse(x+30,y+15,arms2,arms2);

ellipse(x+35,y-35,arms1,arms1);

ellipse(x+45,y+45,arms2,arms2);

ellipse(x-65,y,arms1,arms1);

ellipse(x-35,y+55,arms2,arms2);

ellipse(x,y+65,arms1,arms1);

ellipse(x,y-65,arms2,arms2);

ellipse(x+65,y,arms1,arms1);

ellipse(x-45,y-45,arms2,arms2);

}

}

}



Looking gooood! Finally!!


I scaled it back a little more for the next excercises:



Next I tried to add random... and this happened:

So what I did was convert the int to float in order to add the randomness (see above) and then increased the random value, since I have a scale function active:


Yeay!! I did it!!. One more excercise:


It was too good to be true... this happened:

To place the big coronas is actually a lot harder than I thought. But I think I may be on the right path.

Nope... this still is not working...


This I found actually very hard. I had to try a lot of times, at the end I was able to do it:

This is the whole code:


float x;

float y;


float body = 100;

float arms1 = 20;

float arms2 = 12;


void setup() {

size(800,800);

background(255);

scale(0.2);

for(float x=120; x<3900; x=x+random(0,300)){

for(float y=120; y<3900; y=y+random(0,500)){

//body of corona

stroke(255,115,0);

strokeWeight(2);

fill(255, 115, 0);

ellipse(x,y,body,body);

// corona arms, there are two different sizes, so I just switched between the two of them

stroke(185,20,0);

strokeWeight(2);

fill(255,60,0);

ellipse(x,y,arms1,arms1);

ellipse(x-25,y-15,arms2,arms2);

ellipse(x-35,y+27,arms1,arms1);

ellipse(x+30,y+15,arms2,arms2);

ellipse(x+35,y-35,arms1,arms1);

ellipse(x+45,y+45,arms2,arms2);

ellipse(x-65,y,arms1,arms1);

ellipse(x-35,y+55,arms2,arms2);

ellipse(x,y+65,arms1,arms1);

ellipse(x,y-65,arms2,arms2);

ellipse(x+65,y,arms1,arms1);

ellipse(x-45,y-45,arms2,arms2);

}

}

//big coronas

scale(random(16));

for(float x=100;x<1000;x=x+random(0,400)){

for(float y=100; y<1000; y=y+random(0,400)){

//body of corona

stroke(255,115,0);

strokeWeight(2);

fill(255, 115, 0);

ellipse(x,y,body,body);

// corona arms, there are two different sizes, so I just switched between the two of them

stroke(185,20,0);

strokeWeight(2);

fill(255,60,0);

ellipse(x,y,arms1,arms1);

ellipse(x-25,y-15,arms2,arms2);

ellipse(x-35,y+27,arms1,arms1);

ellipse(x+30,y+15,arms2,arms2);

ellipse(x+35,y-35,arms1,arms1);

ellipse(x+45,y+45,arms2,arms2);

ellipse(x-65,y,arms1,arms1);

ellipse(x-35,y+55,arms2,arms2);

ellipse(x,y+65,arms1,arms1);

ellipse(x,y-65,arms2,arms2);

ellipse(x+65,y,arms1,arms1);

ellipse(x-45,y-45,arms2,arms2);

}

}

}


Still, I do not really feel like I have this down with the scaling. It worked, but I found it hard. Maybe the next excercise won't be as hard. Let's see.

The first attempt was beyond funny:


I decided to make the outlines black, to see the effect better... otherwise not quite there yet:

Then it just got worse. I got an error and the code just wouldn't run.

This one is a hard one, and I find it hard to understand without any kind of explanation.

I think I will just stop here and recap what I have learned till now. I am not able to solve my problem.

And trigonometry just seem way too much for me. I prefer to try and feel a little more secure with the things I do understand. Overall I really don't feel like I got this.

The next day: I wrote Dr. Laubach and asked for help, I was able to do the assignment and it looks like this:

And I was able to do this also:

But I am not feeling confident at all. I think I will recap and reread everthing I have learned till now. Specially the things we learned this week. I don't really understand how or why they work, I just change the numbers and play a little with it, but I don't feel like I have mastered this.

Trigonometry will have to wait...

 
 
 

Comments


© 2020 by Maria Guzman. Proudly created with Wix.com.

bottom of page