html
html
1
2
3
4
5
6
7
8
9
<!DOCTYPE html>
<html>
<head>
<title>HTML Canvas - Particles</title>
</head>
<body>
<canvas></canvas>
</body>
</html>
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
* {
margin: 0;
padding: 0;
border: 0px;
}
body {
height: 100vh;
background: #000;
}
Enter to Rename, Shift+Enter to Preview
js
js
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
// Code Reference: Youtube: Chris Courses: HTML Canvas Tutorial Part 3 & 4
/*
LOG:
07/16/2019 : Created
07/30/2019 : Added assortment of colors
08/04/2019 : Fixed some minor bug, Improved performance
11/02/2019 : Improved with some ES6 syntax, Classes & Constructors
11/06/2019 : Fixed some minor bug
11/07/2019 : Improved quality
*/
onload = function() {
class Circle {
constructor(x, y, dx, dy, radius, defaultRadius, colorIndex) {
this.x = x;
this.y = y;
this.dx = dx;
this.dy = dy;
this.radius = radius;
this.defaultRadius = defaultRadius;
this.colorIndex = colorIndex;
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run