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>Page Title</title>
</head>
<body>
<canvas></canvas>
<script>
const canvas = document.querySelector('canvas');
const ctx = canvas.getContext('2d');
const width = canvas.width = 500;
const height = canvas.height = 500;
class Ball {
constructor(x,y){
this.x = x;
this.y = y;
this.f = 0.05;
}
draw(){
ctx.beginPath();
ctx.arc(this.x, this.y,6 ,0, 2*Math.PI);
ctx.fillStyle = "red";
ctx.fill();
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
body {
}
Enter to Rename, Shift+Enter to Preview
js
js
1
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run