Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PImage barco;
- void setup() {
- size(800, 600);
- imageMode(CENTER);
- barco = loadImage("boat.png");
- }
- void desenhaFundo(float yMar) {
- float x = 0;
- while (x*25<800) {
- float y = sin(x+yMar);
- fill(255);
- noStroke();
- ellipse(x*25, y*10+300, 10, 10);
- fill(7, 39, 236);
- rect(x*25, y*10+298, 10, 400);
- x+=0.1;
- }
- }
- void desenhaBarco(){
- float y = sin(16+yMar);
- pushMatrix();
- translate(16*25, y*10+275);
- rotate(radians(y*10));
- image(barco, 0,-20,80,80);
- popMatrix();
- }
- float yMar=0;
- void draw() {
- background(0, 171, 246);
- desenhaFundo(yMar);
- yMar+=0.07;
- desenhaBarco();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement