+ 2
(JS)The getContext won't working,please help and need explanations.
So, I was start try to make a illustration of sololearn animation does, because wondering how it works. Please help me and explain why it won't work :( *I following the instructions the sololearn give on the course,I would be thankful for your helps! Links my code playground:(Look the JS it's said null, why?) https://code.sololearn.com/WmS2Vy52vmcW/?ref=app
1 Respuesta
+ 5
// Remove script block from HTML section
// In JS section
// move <context> declaration outside onload() because it is needed by draw()
var context, x = 0, y = 100;
window.onload = function()
{
var canvas = document.getElementById("canvas");
context = canvas.getContext("2d");
draw(); // move first draw() call here
};