Skip to content

Commit bf32080

Browse files
committed
added stroke color
1 parent cd86aa9 commit bf32080

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

08 - Fun with HTML5 Canvas/index-START.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,29 @@
77
<body>
88
<canvas id="draw" width="800" height="800"></canvas>
99
<script>
10-
const canvas = document.querySelector('#draw')
11-
const ctx = canvas.getContext('2d')
10+
const canvas = document.querySelector('#draw');
11+
const ctx = canvas.getContext('2d');
1212

1313
canvas.width = window.innerWidth
1414
canvas.height = window.innerHeight
15-
16-
ctx.strokeStyle = '#BADASS'
15+
ctx.strokeStyle = '##BADA55'
1716
ctx.lineJoin = 'round'
1817
ctx.lineCap = 'round'
19-
ctx.lineWidth = 15
18+
ctx.lineWidth = 50
2019

2120
let isDrawing = false
2221
let lastX = 0
2322
let lastY = 0
23+
let hue = 0
2424

2525
function draw (e) {
2626
if (!isDrawing) return
2727
console.log(e)
28+
ctx.strokeStyle = `hsl(${hue}, 100%, 50%)`;
2829
ctx.beginPath()
2930
ctx.moveTo(lastX, lastY)
3031
ctx.lineTo(e.offsetX, e.offsetY)
3132
ctx.stroke()
32-
//[lastX, lastY] = [e.offsetX, e.offsetY]
3333
lastX = e.offsetX
3434
lastY = e.offsetY
3535

0 commit comments

Comments
 (0)