在画布上绘制的圆圈不是圆的

时间:2015-02-24 15:22:42

标签: javascript canvas

创建简单的圆圈时遇到问题。我认为绘制代码的代码就像它所说的那样,而另一个问题是轴。我不知道为什么但是0x点开始在"游戏画面"的中间。如何制作游戏画面640px / 480px?

Fiddle demo |的 Screenshot

start.wyswietl = (function(){
var dom = start.dom,
    $ = dom.$,
    gracz = start.gracz,
    canvas, ctx,
    pUruchomienie = true;

function createBackground(){
    var background = document.createElement("canvas");
    bgctx = background.getContext("2d");
    dom.dodKlase(background, "background");
    background.width = 640;
    background.height = 480;
    background = new Image();
    background.onload = function(){
        bgctx.drawImage(background, 0, 0);

    };

    background.src = "../obrazki/tapeta.png";
    dom.dodKlase(background, "board-bg");
    return background;
}

function rysuj(callback){
    var gracz = document.createElement("canvas");
    gctx = gracz.getContext("2d");
    gctx.fillStyle = "black";
    gctx.arc(5, 40, 5, 0, 2*Math.PI);
    gctx.fill();
  //  dom.dodKlase(gracz, "plansza");
    dom.dodKlase(gracz, "gracze");
    return gracz;
    callback();
}

 //function ()

0 个答案:

没有答案