examples/script/context2d/scripts/moveto2.js
author William Roberts <williamr@symbian.org>
Fri, 11 Jun 2010 16:26:16 +0100
branchGCC_SURGE
changeset 24 24fd0381a9ae
parent 0 1918ee327afb
permissions -rw-r--r--
Branch for GCC_SURGE fixes

var canvas = document.getElementById('tutorial');

  // Make sure we don't execute when canvas isn't supported
  if (canvas.getContext){

    // use getContext to use the canvas for drawing
    var ctx = canvas.getContext('2d');

    // Filled triangle
    ctx.beginPath();
    ctx.moveTo(25,25);
    ctx.lineTo(105,25);
    ctx.lineTo(25,105);
    ctx.fill();
    
    // Stroked triangle
    ctx.beginPath();
    ctx.moveTo(125,125);
    ctx.lineTo(125,45);
    ctx.lineTo(45,125);
    ctx.closePath();
    ctx.stroke();

  }