html
html
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
<!DOCTYPE html>
<html>
<head>
<title>Processing rain</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.6.6/processing.js"></script>
</head>
<body>
<canvas id="Canvas"></canvas>
</body>
<script type="text/processing" data-processing-target="Canvas">
//variables
float g = 0.2; //gravity
ArrayList<Drop> drops = new ArrayList<Drop>();
//functions
class Drop {
//object variables
PVector pos,vel; //position & velocity
float r1 = 6;
float r2 = 26;
//object constructor
Drop() {
this.pos = new PVector((int)random(width), 0);
this.vel = new PVector(0, 0);
}
//object methods
css
css
1
2
3
4
5
6
7
8
9
10
body {
margin: 0;
background-color: #000;
}
canvas {
border: 1px solid red;
width: 350px;
height: 350px;
}
js
js
1
//No js
BROWSER
Console
Run