-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRandom.html
More file actions
62 lines (46 loc) · 1.06 KB
/
Random.html
File metadata and controls
62 lines (46 loc) · 1.06 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.16/p5.js"></script>
<script>
var spot={
x:100,
y:50
}
var col={
r:255,
g:0,
b:0,
y:100
}
var siz={
w:50,
h:50
}
function setup() {
createCanvas(windowWidth,windowHeight);
background('#EBF5FB');
}
function draw() {
spot.x=random(0,width);
spot.y=random(0,height);
//random(min,max)
col.r=random(0,255);
col.g=random(20,250);
col.b=random(0,150);
siz.w=random(20,100);
siz.h=random(20,100);
stroke(col.r,col.g,col.b);
fill(col.r,col.g,col.b,50);
ellipse(spot.x+150,spot.y+150,siz.w,siz.h);
stroke(col.r,col.g,col.b);
fill(col.r,col.g,col.b,50);
rect(spot.x,spot.y,siz.w,siz.h);
stroke(col.r,col.g,col.b);
fill(col.r,col.g,col.b,50);
triangle(spot.x+160,spot.y+100,spot.x+40,spot.y+80,spot.x+80,spot.y+160);
}
</script>
</head>
<body>
</body>
</html>