Canvas reference: The moveTo() function

Summary: The moveTo() function is a path function used when drawing paths

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

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

        context.beginPath();
        context.moveTo(100, 100);
        context.lineTo(200, 200);
        context.stroke();
    }
</script>