-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathmain.js
More file actions
54 lines (34 loc) · 1.33 KB
/
main.js
File metadata and controls
54 lines (34 loc) · 1.33 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
// define the canvas
let canvas = document.getElementById("my-canvas")
// console.log(canvas)
// adjust the canvas
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
// capture the drawing context in a variable
const c = canvas.getContext('2d')
// draw a circle
c.beginPath();
c.strokeStyle = "limegreen";
c.arc(800, 400, 50, 0, 2 * Math.PI);
c.stroke();
// TODO follow the instructions in the Canvas Pt. 2 Pre-Lesson to see how to build this project
const animate = () => {
}
// animate()
// Code to draw new circles on a click of the window
// *************************************************
// window.onclick = () => {
// for(let i=0; i < 50; i++ ) {
// const x = Math.random() * (window.innerWidth - 100)
// const y = Math.random() * (window.innerHeight - 100)
// // the first value will be null to accommodate for no 0 number being drawn
// const colors = [null, "#8C0C3C", "#1B2968", "#4B9C2B", "#A4C89C", "#F8605F", "#F8B493", "#32B9B2", "#F85532", "#C2C8E4", "#357153", "#A061D4", "#404462"]
// const randomIndex = Math.floor(Math.random() * (13 - 1)) + 1;
// // Draw Circle
// c.beginPath();
// // replace "black" with the random color selected from the list
// c.strokeStyle = colors[randomIndex];
// c.arc(x, y, 50, 0, 2 * Math.PI);
// c.stroke();
// }
// }