-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsketch.js
More file actions
40 lines (29 loc) · 759 Bytes
/
sketch.js
File metadata and controls
40 lines (29 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
let cor;
let posicaoHorizontal; // x
let posicaoVertical; // y
function setup() {
createCanvas(400, 400);
background(color(100,0,0));
cor = color(random(0,255), random(0,255), random(0,255));
posicaoHorizontal = 200;
posicaoVertical = 200;
}
function draw() {
fill(cor);
circle(posicaoHorizontal,posicaoVertical,50);
if (mouseX < posicaoHorizontal){
posicaoHorizontal = posicaoHorizontal - 1;
}
if (mouseX > posicaoHorizontal){
posicaoHorizontal = posicaoHorizontal + 1;
}
if (mouseY < posicaoVertical){
posicaoVertical--;
}
if (mouseY > posicaoVertical){
posicaoVertical++;
}
if (mouseIsPressed){
cor = color(random(0,255), random(0,255), random(0,255), random(0,100));
}
}