Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. PImage barco;
  2.  
  3. void setup() {
  4. size(800, 600);
  5. imageMode(CENTER);
  6. barco = loadImage("boat.png");
  7.  
  8. }
  9.  
  10. void desenhaFundo(float yMar) {
  11. float x = 0;
  12. while (x*25<800) {
  13. float y = sin(x+yMar);
  14. fill(255);
  15. noStroke();
  16. ellipse(x*25, y*10+300, 10, 10);
  17. fill(7, 39, 236);
  18. rect(x*25, y*10+298, 10, 400);
  19. x+=0.1;
  20. }
  21. }
  22.  
  23. void desenhaBarco(){
  24. float y = sin(16+yMar);
  25. pushMatrix();
  26. translate(16*25, y*10+275);
  27. rotate(radians(y*10));
  28. image(barco, 0,-20,80,80);
  29. popMatrix();
  30. }
  31. float yMar=0;
  32.  
  33. void draw() {
  34. background(0, 171, 246);
  35. desenhaFundo(yMar);
  36. yMar+=0.07;
  37. desenhaBarco();
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement