Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. PFont myFont;
  2. String myText = "FUN";
  3. PGraphics myPGraphic;
  4. //make a vatriable for the fill PGraphic
  5. color myPGraphicTypeColor = color(0);
  6. //PImage = myImage;
  7.  
  8. int myUnit = 20;
  9.  
  10. //int= any whole number
  11. // float= any whole that can have a decima;
  12. // string = hold text
  13. // Pfont and PGraphic
  14.  
  15. void setup () {
  16. size (960, 540);
  17.  
  18. //myImage = loadImage ("myGraphic.jpg");
  19.  
  20. myFont = createFont ("SourceCodePro-Regular", 200);
  21. // creating blank graphic width and height of canvas
  22. myPGraphic = createGraphics(width, height);
  23. // everything anfter the . will draw to the pGraphic
  24. myPGraphic.beginDraw();
  25. myPGraphic.fill(myPGraphicTypeColor);
  26. myPGraphic.rect(0,0,width/2,height);
  27. //myPGraphic.textFont(myFont);
  28. // myPGraphic.textAlign(CENTER,CENTER);
  29. // myPGraphic.fill(myPGraphicTypeColor);
  30. // myPGraphic.text(myText, width/2, height/2);
  31. myPGraphic.endDraw();
  32.  
  33. //for (int y = 0; y < height; y+= myUnit) {
  34. // for (int x= 0; x < width; x+= myUnit) {
  35. // color myCheckColor = myPGraphic.get(x, y);
  36.  
  37. // // if that color is equal to 0, do the ellipse
  38.  
  39. // if (myCheckColor == myPGraphicTypeColor) {
  40. // ellipse (x, y, 5, 5);
  41. // } else {
  42. // ellipse (x, y, 2, 2);
  43. // }
  44. // }
  45. //}
  46. }
  47.  
  48. void draw() {
  49. //image (myPGraphic, 0, 0);
  50.  
  51.  
  52. int randomX = int(random(width));
  53. int randomY = int (random(height));
  54.  
  55. //color myCheckColor = myPGraphic.get (randomX,randomY);
  56.  
  57. if (myPGraphic.get(randomX,randomY) == myPGraphicTypeColor) {
  58. fill (255,0,0);
  59. ellipse (randomX,randomY,20,20);
  60. }
  61. else {
  62. fill (0,255,0);
  63. ellipse(randomX,randomY,20,20);
  64. }
  65.  
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement