Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. PImage obrazek;
  2. float q = 0;
  3. int value=0;
  4. int step=5;
  5. boolean inc=true;
  6.  
  7. void setup() {
  8. size(750, 500);
  9. background(0);
  10. obrazek = loadImage ("smutnypan.jpg");
  11. }
  12. void draw() {
  13.  
  14. background(0);
  15. //imageMode (CENTER);
  16. image (obrazek, (375), (250), 325, 250);
  17.  
  18.  
  19. if(mouseX > 375 & mouseX < 375+325 & mouseY >250 & mouseY < 250+250 ) {
  20. fill(value,0,0);
  21. if(inc)value+=step;
  22. else value-=step;
  23. if(value>250)
  24. {
  25. inc=false;
  26. value=250;
  27. }
  28. if(value<0){
  29. inc=true;
  30. value=0;
  31. }
  32. } else {
  33. fill(0,127,0);
  34. }
  35.  
  36. ellipse(mouseX, mouseY, 30, 30);
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement