Problem with Canvas stroke() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Problem with Canvas stroke()

Expected output: A blue line and a red line. Instead... https://code.sololearn.com/WpaUhS90qWnX/?ref=app

3rd Sep 2020, 2:21 PM
Nor'wester 🌪️ 🇧🇩 (INACTIVE)
Nor'wester 🌪️ 🇧🇩 (INACTIVE) - avatar
2 Answers
+ 13
Add ctx.beginPath(); after line 9. It resets the current path. It is used when you want to create a new path.
3rd Sep 2020, 2:42 PM
Nova
Nova - avatar
+ 2
Oh. Thanks Nova!
3rd Sep 2020, 3:22 PM
Nor'wester 🌪️ 🇧🇩 (INACTIVE)
Nor'wester 🌪️ 🇧🇩 (INACTIVE) - avatar