/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.G0uBLbUUNfj/rev.1
*
* authors:
* Natalia Valencia
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// paso 1 definicion variable
int posx;
int velx;
color colorbola;
void setup ()
{
size(400, 500);
background(255);
smooth();
//paso 2, iniciar la variable
posx=10;
velx=5;
colorbola= color(210,70,0);
}
void draw()
{
fill (255);
rect (0,0,width, height);
//curva 1
stroke(0);
strokeWeight(2);
beginShape();
//paso 3 usar la variable
vertex(posx,70);
bezierVertex(2,40,43,15,75,55);
endShape();
//curva 2
stroke(0);
strokeWeight(2);
beginShape();
//paso 3 usar la variable
vertex(posx,107);
bezierVertex(18,74,47,47,67,64);
endShape();
//curva 3
stroke(0);
strokeWeight(2);
beginShape();
//paso 3 usar la variable
vertex(posx,119);
bezierVertex(38,95,40,65,64,71);
endShape();
//circulo rojo
noStroke();
beginShape();
fill(colorbola);
ellipse(91,75,52,50);
endShape();
//ojito verde
noStroke();
beginShape();
fill(25,70,11,99);
vertex(170,194);
bezierVertex(70,170,45,56,225,7);
bezierVertex(150,100,160,140,170,194);
endShape();
//estrella
stroke(0);
strokeWeight(2);
line(340,296,342,385);
line(377,298,290,383);
line(305,290,387,395);
line(290,340,381,333);
//negros
//negro1
beginShape();
fill(0);
vertex(90,100);
bezierVertex(110,105,127,80,113,62);
bezierVertex(120,69,102,69,94,100);
endShape();
//negro2
beginShape();
fill(0);
vertex(120,167);
bezierVertex(125,179,152,195,170,194);
bezierVertex(166,186,158,145,164,130);
bezierVertex(141,147,127,162,120,167);
endShape();
//negro3
beginShape();
fill(0);
vertex(67,381);
bezierVertex(85,402,119,375,109,354);
bezierVertex(88,337,57,364,67,381);
endShape();
//negro4
beginShape();
fill(0);
vertex(309,426);
bezierVertex(337,430,342,403,321,401);
bezierVertex(288,403,284,423,309,426);
endShape();
//paso 4 regals o cambios de la variable
posx=posx+velx;
if(posx>width)
{
velx=-5;
}
if(posx<0)
{
posx=+5;
}
}
void mousePressed ()
{
// aqui va lo que uno quiere hacer cuando oprime el mouse
velx=0;
colorbola= color (25,70,11);
}
void keyPressed ()
{
if(key== CODED)
{
if(keyCode== RIGHT)
{
velx=5;
colorbola= color(210,70,0);
}
if (keyCode==LEFT)
{
velx=-5;
colorbola= color(210,70,0);
}
}
}