-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsketch.js
More file actions
149 lines (114 loc) · 2.23 KB
/
Copy pathsketch.js
File metadata and controls
149 lines (114 loc) · 2.23 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
/*
let angle = 0;
let X = 100;
let Y = 100;
//let bg = 0;
let str = "ckjbug";
let colorRandom = random(0,255);
function setup(){
createCanvas(800,400);
//angleMode(DEGREES);
//rectMode(CENTER);
textFont("Libre Caslon Display");
let locX = random(0,800);
let locY = random(0,400);
let s = random(10,50);
background(252,92,101);
}
function draw(){
// background(0);
// translate(X,Y);
// rotate(angle);
// fill(bg++);
// line();
// rect(20,20,10,10);
// angle = angle + 3;
noStroke();
fill(254,211,48);
triangle(400,0,800,0,800,400);
stroke(0,120);
fill(43,203,186);
triangle(800,0,800,400,400,400);
noLoop();
textSize(36);
text(str,100,100);
textSize(24);
text("ckjbug@qq.com",100,150);
Stroke(0);
fill(colorRandom);
square(locX,locY,s);
}
*/
let bubbles = [];
function setup()
{
createCanvas(800,500);
}
function mousePressed()
{
let r = random(10,50);
let b = new bubble(mouseX,mouseY,r);
bubbles.push(b);
}
function draw()
{
background(0);
for(let i = 0; i < bubbles.length; i++)
{
bubbles[i].move();
bubbles[i].show();
}
}
class bubble
{
constructor(x,y,r)
{
this.x = x;
this.y = y;
this.r = r;
}
move()
{
this.x = this.x + random(-5,5);
this.y = this.y + random(-5,5);
this.r = this.r + random(-2,2);
}
show()
{
//stroke(255);
//strokeWeight(4);
fill(random(240),random(240),210);
//noFill();
ellipse(this.x,this.y,this.r * 2);
}
}
/*
var bubble = {
x : 50,
y : 50,
move : function(){
this.x = this.x + random(-5,5);
this.y = this.y + random(-5,5);
stroke(207,48,48);
fill(random(240),random(240),210);
ellipse(this.x,this.y,30,30);
},
display : function(){
for(this.x = 50;this.x <= mouseX - 30;this.x += 62){
stroke(207,48,48);
fill(random(255),random(255),120);
}
for(this.y = 50;this.y <= mouseY - 30;this.y += 60){
ellipse(this.x,this.y,30,30);
}
}
}
function setup(){
createCanvas(600,400);
}
function draw(){
background(17,20,76);
bubble.move();
bubble.display();
}
*/