Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PFont myFont;
- String myText = "FUN";
- PGraphics myPGraphic;
- //make a vatriable for the fill PGraphic
- color myPGraphicTypeColor = color(0);
- //PImage = myImage;
- int myUnit = 20;
- //int= any whole number
- // float= any whole that can have a decima;
- // string = hold text
- // Pfont and PGraphic
- void setup () {
- size (960, 540);
- //myImage = loadImage ("myGraphic.jpg");
- myFont = createFont ("SourceCodePro-Regular", 200);
- // creating blank graphic width and height of canvas
- myPGraphic = createGraphics(width, height);
- // everything anfter the . will draw to the pGraphic
- myPGraphic.beginDraw();
- myPGraphic.fill(myPGraphicTypeColor);
- myPGraphic.rect(0,0,width/2,height);
- //myPGraphic.textFont(myFont);
- // myPGraphic.textAlign(CENTER,CENTER);
- // myPGraphic.fill(myPGraphicTypeColor);
- // myPGraphic.text(myText, width/2, height/2);
- myPGraphic.endDraw();
- //for (int y = 0; y < height; y+= myUnit) {
- // for (int x= 0; x < width; x+= myUnit) {
- // color myCheckColor = myPGraphic.get(x, y);
- // // if that color is equal to 0, do the ellipse
- // if (myCheckColor == myPGraphicTypeColor) {
- // ellipse (x, y, 5, 5);
- // } else {
- // ellipse (x, y, 2, 2);
- // }
- // }
- //}
- }
- void draw() {
- //image (myPGraphic, 0, 0);
- int randomX = int(random(width));
- int randomY = int (random(height));
- //color myCheckColor = myPGraphic.get (randomX,randomY);
- if (myPGraphic.get(randomX,randomY) == myPGraphicTypeColor) {
- fill (255,0,0);
- ellipse (randomX,randomY,20,20);
- }
- else {
- fill (0,255,0);
- ellipse(randomX,randomY,20,20);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement