Hello my friends, I am trying to apply the rotation technique of my drawing, but I am not able to make the drawing rotate without leaving the place.
I remember that to effect this technique I have to pass the width / 2 and height / 2 to translate, but I am not getting the desired effect of rotation of the drawing without leaving the place.
Here is the code below:
fill(random(255), random(255), random(255));
strokeWeight(5);
var estrela = function(posX, posY,giro,tamanho){
pushMatrix();
translate(posX, posY);
rotate(giro);
scale(tamanho);
fill(0, 255, 0);
ellipse(195,109,80,80);
ellipse(122,230,80,80);
ellipse(277,230,80,80);
noFill();
strokeWeight(50);
stroke(0,255,0);
arc(128,134,124,160,346,443);
arc(196,277,169,146,222,322);
arc(263,134,124,160,450,551);
noStroke();
fill(0, 255, 255);
ellipse(195,109,50,50);
ellipse(122,230,50,50);
ellipse(277,230,50,50);
fill(255, 0, 196);
ellipse(195,109,20,20);
ellipse(122,230,20,20);
ellipse(277,230,20,20);
stroke(0,255,255);
strokeWeight(13);
ellipse(195,188,70,70);
//filter(BLUR,12);
noStroke();
fill(0, 255, 0);
ellipse(195,109,80,80);
ellipse(122,230,80,80);
ellipse(277,230,80,80);
noFill();
strokeWeight(50);
stroke(0,255,0);
arc(128,134,124,160,346,443);
arc(196,277,169,146,222,322);
arc(263,134,124,160,450,551);
noStroke();
fill(0, 255, 255);
ellipse(195,109,50,50);
ellipse(122,230,50,50);
ellipse(277,230,50,50);
fill(255, 0, 196);
ellipse(195,109,20,20);
ellipse(122,230,20,20);
ellipse(277,230,20,20);
stroke(0,255,255);
strokeWeight(13);
ellipse(195,188,70,70);
popMatrix();
};
var rotation = 0;
draw = function() {
background(255);
estrela(width/2,height/2,rotation,1.0);
rotation++;
};