Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. PGraphics pgBg, pgFg;
  2.  
  3. void setup() {
  4. size(640, 360);
  5.  
  6. //PGraphic Background
  7. pgBg = createGraphics(width, height);
  8. // PGgraphic Foreground
  9. pgFg = createGraphics(width, height);
  10. }
  11.  
  12. void draw() {
  13. background(0);
  14.  
  15. // Background PGraphic circle with white outline
  16. pgBg.beginDraw();
  17. pgBg.clear();
  18. pgBg.stroke(255);
  19. pgBg.strokeWeight(10);
  20.  
  21. // replace this by the contour.draw();
  22. for (int i = -100; i <= 100; i += 50) {
  23. pgBg.ellipse(mouseX-15 + i, mouseY-15, 30, 30);
  24. }
  25. pgBg.endDraw();
  26.  
  27.  
  28. // Foreground PGraphic Blue circle with red outline
  29. pgFg.beginDraw();
  30. pgFg.clear();
  31. pgFg.fill(0, 0, 255);
  32. pgFg.stroke(255,0,0);
  33. pgFg.strokeWeight(4);
  34.  
  35. // and ALSO replace this by the same contour.draw();
  36. for (int i = -100; i <= 100; i += 50) {
  37. pgFg.ellipse(mouseX-15 + i, mouseY-15, 30,30);
  38. }
  39. pgFg.endDraw();
  40.  
  41. image(pgBg, 0, 0);
  42. image(pgFg, 0, 0);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement