Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PFont myFont; // this variable holds a font
- PGraphics myPGraphic; // the variable holds a graphic
- color myPGraphicTypeColor = color(0);
- PImage myImage;
- String myText = "MISTLETOE";
- int myUnit = 10;
- // this runs once at the begining
- void setup() {
- size(960, 540);
- noStroke();
- myImage = loadImage("myGraphic.jpg");
- myFont = createFont("SourceCodePro-Regular", 100);
- myPGraphic = createGraphics(width, height);
- myPGraphic.beginDraw();
- myPGraphic.fill(myPGraphicTypeColor);
- //myPGraphic.rect(0, 0, width/2, height);
- //myPGraphic.fill(255);
- //myPGraphic.rect(width/2, 0, width/2, height);
- myPGraphic.textFont(myFont);
- myPGraphic.textAlign(CENTER,CENTER);
- //myPGraphic.fill(myPGraphicTypeColor);
- myPGraphic.text(myText,width*.5,height*.5-30);
- myPGraphic.endDraw();
- frameRate(100);
- //for (int y = 0; y < height; y+=myUnit) {
- // for (int x = 0; x < width; x+=myUnit) {
- // color myCheckColor = myPGraphic.get(x, y);
- // print(myCheckColor);
- // if(myPGraphic.get(x, y) == myPGraphicTypeColor){
- // ellipse(x, y, 5, 5);
- // } else {
- // ellipse(x, y, 2, 2);
- //}
- //}
- }
- //}
- //this runs forever
- void draw() {
- //image(myPGraphic, 0, 0);
- //image(myImage,0,0);
- int randomX = int(random(width));
- int randomY = int(random(height));
- color myCheckColor = myPGraphic.get(randomX, randomY);
- print(myCheckColor);
- if (myCheckColor == myPGraphicTypeColor) {
- fill(0, 255, 0);
- ellipse(randomX, randomY, 15, 15);
- fill(255, 0, 0);
- ellipse(randomX+10, randomY+10, 10, 10);
- }
- //else {
- //fill(255, 0, 0);
- //ellipse(randomX, randomY, 50, 50);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement