arbor.jsを使って以下のウェブアプリを作っています。
これの背景に画像を入れたいものの、どうしたらいいかわからずで。。
https://harunonsystem.github.io/illustmap/monacoin/
以下のサイトを見ながらやってみてはいるのですが。。。
http://www.htmq.com/canvas/createPattern.shtml
現在、背景は白一色です。(この部分)
redraw: function () { ctx.fillStyle = "white" ctx.fillRect(0, 0, canvas.width, canvas.height) }
こんな感じになるとは思うのですが。。
redraw: function(){ var img = new Image(); img.src = "../dist/sample.png"; img.onload = function(){ var pattern = context.create.Pattern(img); ctx.fillStyle = pattern; ctx.fillRect(0, 0, canvas.width, canvas.height) ctx.fill(); }}
該当Source Code
https://github.com/harunonsystem/harunonsystem.github.io/blob/master/illustmap/monacoin/js/sample.js
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。