+ 3

On Canvas

What is meant by ctx in canvas

3rd Jul 2018, 12:10 PM
Satya Prakash Reddy Namala
Satya Prakash Reddy Namala - avatar
2 ответов
+ 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()....
3rd Jul 2018, 2:07 PM
Dawid
Dawid - avatar