Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float z,y,x;
- void setup(){
- size(600,600);
- rectMode(CENTER);
- }
- void draw(){
- background(255);
- y = sin(x);
- onda();
- fill(0);
- barco(252,y*30+295);
- x+= 0.02; //controla a velocidade de subida e descida do barco
- }
- void barco(float x, float y){
- rect(x,y,10,10);
- triangle(x+5,y-5,x+5,y+5,x+10,y-5);
- triangle(x-5,y-5,x-5,y+5,x-10,y-5);
- triangle(x,y-20,x,y-10,x+10,y-10);
- stroke(0);
- line(x,y,x,y-20);
- }
- void onda(){
- noStroke();
- fill(0,0,255); //azul
- for (int i = 0; i < width/2; i++){//quantidade de bolas a serem feitas
- float w = sin(z+frameCount*0.02); //essa multiplicaรงรฃo controla a velocidade da onda
- ellipse(z*40,30*w+300,2,2); //z=periodo w = amplitude
- z+= 0.1; //controla o espassamento entre as bolinhas
- }
- z=0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement