The moveTo() function

The moveTo() function is used whilst drawing paths to the canvas to move the 'pen' to a new set of coordinates without drawing a line between them. Like the lineTo() function, only a single pair of X/Y coordinates is given to the function. With some of the path functions (eg bezierCurveTo(), quadraticCurveTo()) the first point is specified by using the moveTo() function.

Arguments to the function

An example

    window.onload = function ()
        var canvas  = document.getElementById("cvs");
        var context = canvas.getContext('2d');

        context.moveTo(100, 100);
        context.lineTo(200, 200);