学习HTML5 canvas第一天




    
    
    












/**
 * Created by Administrator on 15-6-13.
 */
function $(id)
{
    return document.getElementById(id)
}
function createContext(id)
{
    var node = $(id);
    if (node != null && node != undefined)
    {
        var context = node.getContext("2d");
        return context;
    }

    return null;
}
function drawCircle(context,radis, x, y,isFill)
{
    if (context != null) {
        context.beginPath();
        context.arc(x, y, radis, 0, 2 * Math.PI);
        if (isFill == true)
        {
            context.fillStyle = "black";
            context.fill();
        }
        else
        {
            context.strokeStyle = "green"
            context.stroke()
        }
        context.closePath();
    }
}

function drawSqure(context,radis, x, y)
{
    if (context != null)
    {
        context.beginPath();
        context.arc(x,y,radis,0, 2*Math.PI);
        context.strokeStyle = "green"
        context.stroke()
        context.closePath();
    }
}

你可能感兴趣的:(php)