Advertisement
atanasovetr

Untitled

Mar 14th, 2019
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.01 KB | None | 0 0
  1. int x = 100;
  2. int y = 100;
  3. color c = color(255, 255, 255);
  4. void setup() {
  5.  
  6.   size(600, 600);
  7.   background(255, 255, 255);
  8.   krugche(x, y, c);
  9. }
  10.  
  11. void draw() {
  12. }
  13.  
  14.  
  15. void krugche(int x, int y, color c) {
  16.  
  17.   ellipse(width/2, height/2, x, y);
  18. }
  19. void keyPressed() {
  20.  
  21.   if (keyPressed && key == 'r' ) {
  22.     c =color(255, 0, 0);
  23.   }
  24.   if (keyPressed && key == 'g' ) {
  25.     c =color(0, 255, 0);
  26.   }
  27.   if (keyPressed && key == 'b' ) {
  28.     c =color(0, 0, 255);
  29.   }
  30.   if (keyPressed && key == '1' ) {
  31.  
  32.     background(255, 255, 255);
  33.     krugche(x, y, c);
  34.   } else if (keyPressed && key == '2' ) {
  35.  
  36.     background(255, 255, 255);
  37.     krugche(x*2, y*2, c);
  38.   } else if (keyPressed && key == '3' ) {
  39.  
  40.     background(255, 255, 255);
  41.     krugche(x*3, y*3, c);
  42.   } else if (keyPressed && key == '4' ) {
  43.  
  44.     background(255, 255, 255);
  45.     krugche(x*4, y*4, c);
  46.   } else if (keyPressed && key == '5' ) {
  47.  
  48.  
  49.     background(255, 255, 255);
  50.     krugche(x*5, y*5, c);
  51.   }
  52.   fill(c);
  53.  
  54.   x=100;
  55.   y=100;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement