0
var device = false;
var a0 = (device? 'rgba(0,169,157,0.6)' : {darker: 'rgba(0,122,133,1)', start: 'rgba(67,192,183,0)', end: 'rgba(0,169,157,1)', angle: 156.1});
var a1 = (device? 'rgba(41,171,226,0.6)' : {darker: 'rgba(1,101,166,1)', start: 'rgba(21,131,196,1)', end: 'rgba(132,207,238,.1)', angle: 180-11.1});
var a2 = (device? 'rgba(200,200,200,0.6)' : {darker: 'rgba(120,120,120,0.4)', start: 'rgba(90,90,90,1)', end: 'rgba(80,80,80,0.4)', angle: 245});

I'm just starting out on canvas thingy.

So I have these lines to change the color of the circles I have on my canvas. but rather than these colors, I want to add an image into it, preferably as background image or something. is it possible to achieve this?

4

1 に答える 1

0

ご質問の内容が理解できるかわかりませんが、

(これは html5 キャンバスのみです: http://shedlimited.debrucellc.com/ )

これを行うためのhtml5キャンバス+ kinetic.js -->

http://jsfiddle.net/aqaP7/4/

(ドラッグ可能な円は、同時に設定される HTML5 クリッピング制約に依存します)

 // draw clipping rectangle
                    context.beginPath();
                    context.rect(box._x, box._y, 200, 100);
                    context.clip();

                    // draw circle
                    context.beginPath();
                    context.arc(this._x, this._y, 50, 0, 2 * Math.PI, false);
                    context.fillStyle = "blue";
                    context.fill();
                    context.closePath();
                },

そこに背景画像を描きたい場合は、同時に画像を描くことができます

于 2013-01-23T05:38:43.903 に答える