CleverCode

Random Ball

Mar 8th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var punto = {
  2.   x: 100,
  3.   y: 50
  4. };
  5.  
  6. var colore = {
  7.   r: 255,
  8.   g: 0,
  9.   b: 0
  10. };
  11.  
  12. function setup() {
  13.   createCanvas(600, 400);
  14.   background(0);
  15. }
  16.  
  17. function draw() {
  18.   punto.x = random(0, width);
  19.   punto.y = random(0, height);
  20.   colore.r = random(100, 255);
  21.   colore.g = 0;
  22.   colore.b = random(100, 190);
  23.   noStroke();
  24.   fill(colore.r, colore.g, colore.b, 100);
  25.   ellipse(punto.x, punto.y, 24, 24);
  26. }
  27.  
  28. function mousePressed(){
  29.   background(0);
  30. }
Add Comment
Please, Sign In to add comment