Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int r = 10;
- int g = 10;
- int b = 10;
- void setup()
- {
- size(850,1100);
- background(255);
- }
- void draw() {
- fill(r,g,b);
- noStroke();
- rect(0,0,100,12);
- fill(255);
- text((r + "," + g + "," + b),10,10);
- if(key == 'r')
- {
- r++;
- }
- //FIGURE 8-3:
- //The RGB color setting for
- //your pen. Use the R, G,
- //and B keys to change the
- //color.
- //142 • PROJECT 8
- key = ' ';
- if(r > 255)
- {
- r = 0;
- }
- else if(key == 'g')
- {
- g++;
- key = ' ';
- if(g > 255)
- {
- g = 0;
- }
- }
- else if(key == 'b')
- {
- b++;
- key = ' ';
- if(b > 255)
- {
- b = 0;
- }
- }
- }
- void mouseDragged()
- {
- if(mouseButton == LEFT)
- {
- strokeWeight(50);
- stroke(r,g,b);
- line(pmouseX,pmouseY,mouseX,mouseY);
- }
- }
Add Comment
Please, Sign In to add comment