0

Can soneone tell me the error in this in the context one?

var canvas = document.createElement("canvas") document.body.appendChild(canvas) /*canvas.width = 300px canvas.height = 300px*/ var context = canvas.getContext('2d') context.fillStyle = 'green' context.fillRect(0, 0, 10, 10) var x = 0 window.requestAnimationFrame(function loop() { x += 1 context.fillStyle = 'red' context.fillRect(0, 0, 100, 100) }) /*var c =document.getElementById("mycanvas"); var ctx = c.getContext("2d"); ctx.fillText("Start", 0 , 10);*/ /* context.font ='25px Arial'; context.fillStyle ='black'; context.fillText("Start Game",100,200);*/

8th Aug 2022, 5:01 PM
Samit Shrestha
Samit Shrestha - avatar
3 Antworten
+ 3
You can link your code like this: Click +, Insert Code, sort for My Code Bits, select your code. This way it is more readable and people can test your code.
8th Aug 2022, 6:14 PM
Lisa
Lisa - avatar
+ 2
What error are you talking about?
8th Aug 2022, 8:45 PM
Solo
Solo - avatar
9th Aug 2022, 5:12 AM
Samit Shrestha
Samit Shrestha - avatar