BIT-101 [2003-2017]

Linescapes Iteration 1


Draw a line.

[php lang=“JavaScript”]$(function() {
var canvas, context, width, height;

canvas = $("#canvas").get(0);
context = canvas.getContext(“2d”);
width = canvas.width;
height = canvas.height;

context.beginPath();
context.moveTo(0, height / 2);
context.lineTo(width, height / 2);
context.stroke();
});[/php]

Result.

« Previous Post
Next Post »