+ 3
On Canvas
What is meant by ctx in canvas
1 Resposta
+ 1
"ctx" generally represents the name of the canvas object. That doesnt have to be "ctx", often you can also meet "context". You can use also something different:
var canvas = document.getElementById("canvas");
ctx = canvas.getContext("2d");
than: ctx.fill(), ctx.beginPath(), ctx.fillStyle()....
or
var canvas = document.getElementById("canvas");
context = canvas.getContext("2d");
than: context.fill(), context.beginPath(), context.fillStyle()....
or for example
var canvas = document.getElementById("canvas");
myCanvas = canvas.getContext("2d");
than: myCanvas.fill(), myCanvas.beginPath(), myCanvas.fillStyle()....