星历2016年02月16日 15:43:43, 银河系厄尔斯星球中华帝国江南行省。
[工程师阿伟]正在和[机器小伟]一起研究位置和方向。
<span style="font-size:18px;">function myDraw() { var config = new PlotConfiguration(); config.init(); config.setPreference(); var image = new Image(); image.src = './1.jpg'; image.onload = function() { plot.drawImage(image); var x0 = 302, y0 = 184; var r = 40; plot.setStrokeStyle('red'); for (var i = 1; i < 5; i++) { shape.strokeCircle(x0, y0, i * r); } plot.setFillStyle('blue'); var d1 = 200/100*r, a1 = Math.PI*2/3; var d2 = 300/100*r, a2 = Math.PI/2; shape.fillCircle(x0+d1*Math.cos(a1), y0-d1*Math.sin(a1), 10); plot.fillText('B市', x0+d1*Math.cos(a1)+20, y0-d1*Math.sin(a1), 100); shape.fillCircle(x0+d2*Math.cos(a2), y0-d2*Math.sin(a2), 10); plot.fillText('C市', x0+d2*Math.cos(a2)+20, y0-d2*Math.sin(a2), 100); } }</span>
[人叫板老师]举的是台风的例子,可是台风一般来说不会这样走直线啊,哈哈哈。
<span style="font-size:18px;">function myDraw() { var config = new PlotConfiguration(); config.init(); config.setPreference(); var image = new Image(); image.src = './1.jpg'; image.onload = function() { plot.drawImage(image); var x0 = 267, y0 = 259; var r = 40, r0 = 10; plot.setStrokeStyle('red'); for (var i = 1; i < 6; i++) { shape.strokeCircle(x0, y0, i * r); } plot.setFillStyle('blue'); //教学楼 var d1 = 150/50*r, a1 = Math.PI/2; //图书馆 var d2 = 150/50*r, a2 = Math.PI/180*55; //体育馆 var d3 = 200/50*r, a3 = Math.PI/180*140; var x = 0, y = 0; x = x0+d1*Math.cos(a1), y = y0-d1*Math.sin(a1); shape.fillCircle(x, y, r0); plot.fillText('教学楼', x+20, y, 100); plot.beginPath() .moveTo(x0, y0) .lineTo(x, y) .closePath() .stroke(); x = x0+d2*Math.cos(a2), y = y0-d2*Math.sin(a2); shape.fillCircle(x, y, r0); plot.fillText('图书馆', x+20, y, 100); plot.beginPath() .moveTo(x0, y0) .lineTo(x, y) .closePath() .stroke(); x = x0+d3*Math.cos(a3), y = y0-d3*Math.sin(a3); shape.fillCircle(x, y, r0); plot.fillText('体育馆', x+20, y, 100); plot.beginPath() .moveTo(x0, y0) .lineTo(x, y) .closePath() .stroke(); } }</span>
<span style="font-size:18px;">function myDraw() { var config = new PlotConfiguration(); config.init(); config.setPreference(); var image = new Image(); image.src = './1.jpg'; image.onload = function() { plot.drawImage(image); var x0 = 221, y0 = 82; var r = 20, r0 = 10; plot.setStrokeStyle('red'); for (var i = 1; i < 9; i++) { shape.strokeCircle(x0, y0, i * r); } plot.setStrokeStyle('blue'); var x = 0, y = 0, thita=0; for (var i = 0; i < 12; i++) { thita = Math.PI*(i/6); x = x0 + 3 * r * Math.cos(thita); y = y0 -3 * r * Math.sin(thita); plot.beginPath() .moveTo(x0, y0) .lineTo(x, y) .closePath() .stroke(); } } }</span>
本节到此结束,欲知后事如何,请看下回分解。