1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
|
calcEight(pointR, pointR, canvasW * 0.05, 1,canvasW * 0.02, canvasW * 0.15, "#E4AF6A"); calcEight(pointR, pointR, canvasW * 0.05, 11,canvasW * 0.02, canvasW * 0.15, "#F8EEB0");
calcEight(pointR, pointR, canvasW * 0.1, 28,canvasW * 0.08, canvasW * 0.35, "#E4AF6A"); calcEight(pointR, pointR, canvasW * 0.1, 36,canvasW * 0.08, canvasW * 0.35, "#F8EEB0");
calcEight(pointR, pointR, canvasW * 0.075, 20,canvasW * 0.058, canvasW * 0.3, "#E4AF6A"); calcEight(pointR, pointR, canvasW * 0.075, 28,canvasW * 0.058, canvasW * 0.3, "#F8EEB0");
calcEight(pointR, pointR, canvasW * 0.29, 9,canvasW * 0.03, canvasW * 0.2, "#E4AF6A"); calcEight(pointR, pointR, canvasW * 0.29, 1,canvasW * 0.03, canvasW * 0.2, "#F8EEB0");
function draw1(x,y,h,w, r,a,color) { var angel = a; var sinAngel = Math.sin(angel*Math.PI / 180); var cosAngel = Math.cos(angel*Math.PI / 180); var tanAngel = Math.tan(angel*Math.PI / 180); var hypotenuse = h / 2 / Math.sin(angel*Math.PI / 180); var p1x = x - ((w * rate - h / 2 / tanAngel) * cosAngel + hypotenuse); var p1y = y - (w * rate - h / 2 / tanAngel) * sinAngel; var p2x = x - ((w - h / 2 / tanAngel) * cosAngel + hypotenuse); var p2y = y - (w - h / 2 / tanAngel) * sinAngel ; var p3x = x - w * cosAngel; var p3y = y - w * sinAngel; var p4x = x - ((w + h / 2 / tanAngel) * cosAngel - hypotenuse); var p4y = y - (w + h / 2 / tanAngel) * sinAngel; var p5x = x - ((w * rate + h / 2 / tanAngel) * cosAngel - hypotenuse); var p5y = y - (w * rate + h / 2 / tanAngel) * sinAngel; ctx.beginPath(); ctx.moveTo(x,y); ctx.stroke(); ctx.bezierCurveTo(p1x,p1y,p2x, p2y,p3x,p3y); ctx.bezierCurveTo(p4x, p4y,p5x,p5y,x,y); ctx.closePath(); ctx.fillStyle = color; ctx.fill(); }
function draw2(x,y,h,w, r,a,color) { var angel = a; var sinAngel = Math.sin(angel*Math.PI / 180); var cosAngel = Math.cos(angel*Math.PI / 180); var tanAngel = Math.tan(angel*Math.PI / 180); var hypotenuse = h / 2 / Math.sin(angel*Math.PI / 180); var p1x = x + ((w * rate - h / 2 / tanAngel) * cosAngel + hypotenuse); var p1y = y + (w * rate - h / 2 / tanAngel) * sinAngel; var p2x = x + ((w - h / 2 / tanAngel) * cosAngel + hypotenuse); var p2y = y + (w - h / 2 / tanAngel) * sinAngel ; var p3x = x + w * cosAngel; var p3y = y + w * sinAngel; var p4x = x + ((w + h / 2 / tanAngel) * cosAngel - hypotenuse); var p4y = y + (w + h / 2 / tanAngel) * sinAngel; var p5x = x + ((w * rate + h / 2 / tanAngel) * cosAngel - hypotenuse); var p5y = y + (w * rate + h / 2 / tanAngel) * sinAngel; ctx.beginPath(); ctx.moveTo(x,y); ctx.bezierCurveTo(p1x,p1y,p2x, p2y,p3x,p3y); ctx.bezierCurveTo(p4x, p4y,p5x,p5y,x,y); ctx.closePath(); ctx.fillStyle = color; ctx.fill(); }
function draw3(x,y,h,w, r,a,color) { var angel = 90 - a; var sinAngel = Math.sin(angel*Math.PI / 180); var cosAngel = Math.cos(angel*Math.PI / 180); var tanAngel = Math.tan(angel*Math.PI / 180); var hypotenuse = h / 2 / Math.sin(angel*Math.PI / 180); var p1x = x + ((w * rate - h / 2 / tanAngel) * cosAngel + hypotenuse); var p1y = y - (w * rate - h / 2 / tanAngel) * sinAngel; var p2x = x + ((w - h / 2 / tanAngel) * cosAngel + hypotenuse); var p2y = y - (w - h / 2 / tanAngel) * sinAngel ; var p3x = x + w * cosAngel; var p3y = y - w * sinAngel; var p4x = x + ((w + h / 2 / tanAngel) * cosAngel - hypotenuse); var p4y = y - (w + h / 2 / tanAngel) * sinAngel; var p5x = x + ((w * rate + h / 2 / tanAngel) * cosAngel - hypotenuse); var p5y = y - (w * rate + h / 2 / tanAngel) * sinAngel; ctx.beginPath(); ctx.moveTo(x,y); ctx.bezierCurveTo(p1x,p1y,p2x, p2y,p3x,p3y); ctx.bezierCurveTo(p4x, p4y,p5x,p5y,x,y); ctx.closePath(); ctx.fillStyle = color; ctx.fill(); }
function draw4(x,y,h,w, r,a,color) { var angel = 90 - a; var sinAngel = Math.sin(angel*Math.PI / 180); var cosAngel = Math.cos(angel*Math.PI / 180); var tanAngel = Math.tan(angel*Math.PI / 180); var hypotenuse = h / 2 / Math.sin(angel*Math.PI / 180); var p1x = x - ((w * rate - h / 2 / tanAngel) * cosAngel + hypotenuse); var p1y = y + (w * rate - h / 2 / tanAngel) * sinAngel; var p2x = x - ((w - h / 2 / tanAngel) * cosAngel + hypotenuse); var p2y = y + (w - h / 2 / tanAngel) * sinAngel ; var p3x = x - w * cosAngel; var p3y = y + w * sinAngel; var p4x = x - ((w + h / 2 / tanAngel) * cosAngel - hypotenuse); var p4y = y + (w + h / 2 / tanAngel) * sinAngel; var p5x = x - ((w * rate + h / 2 / tanAngel) * cosAngel - hypotenuse); var p5y = y + (w * rate + h / 2 / tanAngel) * sinAngel; ctx.beginPath(); ctx.moveTo(x,y); ctx.bezierCurveTo(p1x,p1y,p2x, p2y,p3x,p3y); ctx.bezierCurveTo(p4x, p4y,p5x,p5y,x,y); ctx.closePath(); ctx.fillStyle = color; ctx.fill(); }
function draw5(x,y,h,w, r,a,color) { var angel = a + 45; var sinAngel = Math.sin(angel*Math.PI / 180); var cosAngel = Math.cos(angel*Math.PI / 180); var tanAngel = Math.tan(angel*Math.PI / 180); var hypotenuse = h / 2 / Math.sin(angel*Math.PI / 180); var p1x = x - ((w * rate - h / 2 / tanAngel) * cosAngel + hypotenuse); var p1y = y - (w * rate - h / 2 / tanAngel) * sinAngel; var p2x = x - ((w - h / 2 / tanAngel) * cosAngel + hypotenuse); var p2y = y - (w - h / 2 / tanAngel) * sinAngel ; var p3x = x - w * cosAngel; var p3y = y - w * sinAngel; var p4x = x - ((w + h / 2 / tanAngel) * cosAngel - hypotenuse); var p4y = y - (w + h / 2 / tanAngel) * sinAngel; var p5x = x - ((w * rate + h / 2 / tanAngel) * cosAngel - hypotenuse); var p5y = y - (w * rate + h / 2 / tanAngel) * sinAngel; ctx.beginPath(); ctx.moveTo(x,y); ctx.stroke(); ctx.bezierCurveTo(p1x,p1y,p2x, p2y,p3x,p3y); ctx.bezierCurveTo(p4x, p4y,p5x,p5y,x,y); ctx.closePath(); ctx.fillStyle = color; ctx.fill(); }
function draw6(x,y,h,w, r,a,color) { var angel = 45 - a; var sinAngel = Math.sin(angel*Math.PI / 180); var cosAngel = Math.cos(angel*Math.PI / 180); var tanAngel = Math.tan(angel*Math.PI / 180); var hypotenuse = h / 2 / Math.sin(angel*Math.PI / 180); var p1x = x + ((w * rate - h / 2 / tanAngel) * cosAngel + hypotenuse); var p1y = y - (w * rate - h / 2 / tanAngel) * sinAngel; var p2x = x + ((w - h / 2 / tanAngel) * cosAngel + hypotenuse); var p2y = y - (w - h / 2 / tanAngel) * sinAngel ; var p3x = x + w * cosAngel; var p3y = y - w * sinAngel; var p4x = x + ((w + h / 2 / tanAngel) * cosAngel - hypotenuse); var p4y = y - (w + h / 2 / tanAngel) * sinAngel; var p5x = x + ((w * rate + h / 2 / tanAngel) * cosAngel - hypotenuse); var p5y = y - (w * rate + h / 2 / tanAngel) * sinAngel; ctx.beginPath(); ctx.moveTo(x,y); ctx.bezierCurveTo(p1x,p1y,p2x, p2y,p3x,p3y); ctx.bezierCurveTo(p4x, p4y,p5x,p5y,x,y); ctx.closePath(); ctx.fillStyle = color; ctx.fill(); }
function draw7(x,y,h,w, r,a,color) { var angel = 45 - a; var sinAngel = Math.sin(angel*Math.PI / 180); var cosAngel = Math.cos(angel*Math.PI / 180); var tanAngel = Math.tan(angel*Math.PI / 180); var hypotenuse = h / 2 / Math.sin(angel*Math.PI / 180); var p1x = x - ((w * rate - h / 2 / tanAngel) * cosAngel + hypotenuse); var p1y = y + (w * rate - h / 2 / tanAngel) * sinAngel; var p2x = x - ((w - h / 2 / tanAngel) * cosAngel + hypotenuse); var p2y = y + (w - h / 2 / tanAngel) * sinAngel ; var p3x = x - w * cosAngel; var p3y = y + w * sinAngel; var p4x = x - ((w + h / 2 / tanAngel) * cosAngel - hypotenuse); var p4y = y + (w + h / 2 / tanAngel) * sinAngel; var p5x = x - ((w * rate + h / 2 / tanAngel) * cosAngel - hypotenuse); var p5y = y + (w * rate + h / 2 / tanAngel) * sinAngel; ctx.beginPath(); ctx.moveTo(x,y); ctx.bezierCurveTo(p1x,p1y,p2x, p2y,p3x,p3y); ctx.bezierCurveTo(p4x, p4y,p5x,p5y,x,y); ctx.closePath(); ctx.fillStyle = color; ctx.fill(); }
function draw8(x,y,h,w, r,a,color) { var angel = 45 + a; var sinAngel = Math.sin(angel*Math.PI / 180); var cosAngel = Math.cos(angel*Math.PI / 180); var tanAngel = Math.tan(angel*Math.PI / 180); var hypotenuse = h / 2 / Math.sin(angel*Math.PI / 180); var p1x = x + ((w * rate - h / 2 / tanAngel) * cosAngel + hypotenuse); var p1y = y + (w * rate - h / 2 / tanAngel) * sinAngel; var p2x = x + ((w - h / 2 / tanAngel) * cosAngel + hypotenuse); var p2y = y + (w - h / 2 / tanAngel) * sinAngel ; var p3x = x + w * cosAngel; var p3y = y + w * sinAngel; var p4x = x + ((w + h / 2 / tanAngel) * cosAngel - hypotenuse); var p4y = y + (w + h / 2 / tanAngel) * sinAngel; var p5x = x + ((w * rate + h / 2 / tanAngel) * cosAngel - hypotenuse); var p5y = y + (w * rate + h / 2 / tanAngel) * sinAngel; ctx.beginPath(); ctx.moveTo(x,y); ctx.bezierCurveTo(p1x,p1y,p2x, p2y,p3x,p3y); ctx.bezierCurveTo(p4x, p4y,p5x,p5y,x,y); ctx.closePath(); ctx.fillStyle = color; ctx.fill(); } function calcEight(x,y,r, angle,h, w, color) { var p1x = x - r * Math.cos(angle * Math.PI / 180); var p1y = y - r * Math.sin(angle * Math.PI / 180); var p2x = x + r * Math.cos(angle * Math.PI / 180); var p2y = y + r * Math.sin(angle * Math.PI / 180); var p3x = x + r * Math.sin(angle * Math.PI / 180); var p3y = y - r * Math.cos(angle * Math.PI / 180); var p4x = x - r * Math.sin(angle * Math.PI / 180); var p4y = y + r * Math.cos(angle * Math.PI / 180); var p5x = x - r * Math.cos((angle + 45) * Math.PI / 180); var p5y = y - r * Math.sin((angle + 45) * Math.PI / 180); var p6x = x + r * Math.cos((45 - angle) * Math.PI / 180); var p6y = y - r * Math.sin((45 - angle) * Math.PI / 180); var p7x = x - r * Math.cos((45 - angle) * Math.PI / 180); var p7y = y + r * Math.sin((45 - angle) * Math.PI / 180); var p8x = x + r * Math.cos((angle + 45) * Math.PI / 180); var p8y = y + r * Math.sin((angle + 45) * Math.PI / 180); draw1(p1x, p1y, h, w, Math.PI,angle,color); draw2(p2x, p2y, h, w, Math.PI,angle,color); draw3(p3x, p3y, h, w, Math.PI / 2,angle,color); draw4(p4x, p4y, h, w, Math.PI / 2,angle,color); draw5(p5x, p5y, h, w, Math.PI,angle,color); draw6(p6x, p6y, h, w, Math.PI,angle,color); draw7(p7x, p7y, h, w, Math.PI / 2,angle,color); draw8(p8x, p8y, h, w, Math.PI / 2,angle,color); }
|