重なり合う形状の配列を作成しようとしています。しかし、これらの形状が互いに重なり合うのを防ぐのに苦労しています。
それが理にかなっているなら、それらを噛み合わせたいと思いますか?
コードは次のとおりです。
var overlap_canvas = document.getElementById("overlap");
var overlap_context = overlap_canvas.getContext("2d");
var x = 200;
var y = x;
var rectQTY = 4 // Number of rectangles
overlap_context.translate(x,y);
for (j=0;j<rectQTY;j++){ // Repeat for the number of rectangles
// Draw a rectangle
overlap_context.beginPath();
overlap_context.rect(-90, -100, 180, 80);
overlap_context.fillStyle = 'yellow';
overlap_context.fill();
overlap_context.lineWidth = 7;
overlap_context.strokeStyle = 'blue';
overlap_context.stroke();
// Degrees to rotate for next position
overlap_context.rotate((Math.PI/180)*360/rectQTY);
}
そして、ここに私のjsFiddleがあります: http://jsfiddle.net/Q8yjP/
そして、これが私が達成しようとしていることです:
ヘルプやガイダンスをいただければ幸いです。