Skip to content

Commit f9c7070

Browse files
authored
Merge pull request #15 from sqdorte/master
blebubs
2 parents c9efac6 + 8b22887 commit f9c7070

File tree

2 files changed

+72
-1
lines changed

2 files changed

+72
-1
lines changed

sqdorte/blebubs.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
function z(r) {
2+
bubbles = [];
3+
4+
for (var x = 0; x <= Math.floor(Math.random()*r*10+r/2); x++) {
5+
theta = Math.random()*360;
6+
7+
i = cos(theta)*r;
8+
j = sin(theta)*r;
9+
10+
bubbles.push(createVector(i,j,Math.random()*30));
11+
}
12+
13+
return bubbles;
14+
}
15+
16+
function setup() {
17+
createCanvas(windowWidth, windowHeight);
18+
noStroke();
19+
background(0);
20+
21+
blebubs = [];
22+
m = null
23+
}
24+
25+
function mousePressed() {
26+
m = createVector(mouseX, mouseY);
27+
}
28+
29+
function mouseReleased() {
30+
c = createVector(m.x, m.y);
31+
r = dist(m.x, m.y, mouseX, mouseY);
32+
bubbles = z(r);
33+
blebubs.push([c, bubbles]);
34+
m = null
35+
}
36+
37+
function draw() {
38+
background(66, 67, 68);
39+
40+
if (m != null) {
41+
noFill();
42+
stroke(255);
43+
ellipse(m.x, m.y, dist(m.x, m.y, mouseX, mouseY)*2);
44+
}
45+
46+
noStroke();
47+
48+
blebubs.forEach(o => {
49+
c = o[0];
50+
bubbles = o[1];
51+
s = false;
52+
53+
Array.from(bubbles.entries()).forEach(k => {
54+
index = k[0];
55+
bubble = k[1];
56+
57+
fill(5500/bubble.z, bubble.z*4);
58+
59+
ellipse(c.x+bubble.x, c.y+bubble.y, bubble.z);
60+
bubble.y -= 50/bubble.z
61+
62+
if (c.y+bubble.y >= -bubble.z) {
63+
s = true
64+
}
65+
});
66+
67+
if (!s) {
68+
bubbles = []
69+
}
70+
})
71+
}

sqdorte/menu.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
window.onload = function() {
22

3-
arts = ['artegenerativafoda', 'generartistic', 'selgnairt'];
3+
arts = ['artegenerativafoda', 'generartistic', 'selgnairt', 'blebubs'];
44
ul = document.getElementById('ul');
55

66
arts.forEach(art => {

0 commit comments

Comments
 (0)