[从头学数学] 第08节 认识钟表
2015-12-19 15:06
369 查看
剧情提要:
[机器小伟]在[工程师阿伟]的陪同下进行着修炼,
本节的主题是[认识钟表]。
正剧开始:
星历2015年12月19日 14:59:09, 银河系厄尔斯星球中华帝国江南行省。
[工程师阿伟]正在和小伟一起认识着钟表。
星历2015年12月19日 15:00:46, [工程师阿伟]说:你看[人叫板老师]举的这个小明的一天
的例子,多么简单明了,你可以吗?[机器小伟]。
星历2015年12月19日 15:01:14, [机器小伟]回答道:[阿伟大人],看我的吧。
15:01:50, 小伟摸出了阿伟给他设计的钟表模块。
小伟说,你看我要是这样绘制:
就可以得到我小伟的一天了。
星历2015年12月19日 15:02:16, [机器小伟]说:[阿伟大人],来看看小伟的一天吧。
15:03:10, 接着,小伟又看了一会修炼功法的其它部分
还有这个:
以小伟的无极限智商来说,学会这些还真是轻松快乐。
本节到此结束,欲知后事如何,请看下回分解。
[机器小伟]在[工程师阿伟]的陪同下进行着修炼,
本节的主题是[认识钟表]。
正剧开始:
星历2015年12月19日 14:59:09, 银河系厄尔斯星球中华帝国江南行省。
[工程师阿伟]正在和小伟一起认识着钟表。
星历2015年12月19日 15:00:46, [工程师阿伟]说:你看[人叫板老师]举的这个小明的一天
的例子,多么简单明了,你可以吗?[机器小伟]。
星历2015年12月19日 15:01:14, [机器小伟]回答道:[阿伟大人],看我的吧。
15:01:50, 小伟摸出了阿伟给他设计的钟表模块。
<span style="font-size:18px;">/** * @usage 绘制钟表 * @author mw * @date 2015年12月19日 星期六 14:04:24 * @param * @return * */ function drawClock(xOff, yOff, r, hour, minute) { plot.save() .translate(xOff, yOff); //钟面 strokeCircle(0, 0, r); var x = 0, y = 0; fillCircle(x, y, r * 0.05); for (var i = 0 ; i < 12; i++) { x = 0.88 * r * Math.cos(Math.PI / 6 * i); y = 0.88 * r * Math.sin(Math.PI / 6 * i); if (i % 3 == 0) { fillCircle(x, y, r * 0.1); } else { fillCircle(x, y, r * 0.05); } } var thitaM = minute / 60 * Math.PI * 2 - Math.PI/2; var thitaH = (hour + minute / 60 ) / 12 * Math.PI * 2-Math.PI/2; //时钟 var x1 = 0.5 * r * Math.cos(thitaH), y1 = 0.5 * r * Math.sin(thitaH), x2 = 0.15 * r * Math.cos(thitaH-Math.PI/18), y2 = 0.15 * r * Math.sin(thitaH-Math.PI/18), x3 = 0.15 * r * Math.cos(thitaH+Math.PI/18), y3 = 0.15 * r * Math.sin(thitaH+Math.PI/18); plot.setLineWidth(3) .beginPath() .moveTo(0, 0) .lineTo(x2, y2) .lineTo(x1, y1) .lineTo(x3, y3) .closePath() .stroke(); //分钟 x1 = 0.75 * r * Math.cos(thitaM), y1 = 0.75 * r * Math.sin(thitaM), x2 = 0.15 * r * Math.cos(thitaM-Math.PI/18), y2 = 0.15 * r * Math.sin(thitaM-Math.PI/18), x3 = 0.15 * r * Math.cos(thitaM+Math.PI/18), y3 = 0.15 * r * Math.sin(thitaM+Math.PI/18); plot.setLineWidth(3) .beginPath() .moveTo(0, 0) .lineTo(x2, y2) .lineTo(x1, y1) .lineTo(x3, y3) .closePath() .stroke(); plot.restore(); } function clock(hour, minute) { return drawClock(0, 0, 70, hour, minute); }</span>
小伟说,你看我要是这样绘制:
<span style="font-size:18px;"> plot.fillText('[机器小伟]的一天', 20, 30, 100); /* setSector(2,2,1,1); plot.fillText('起床', -20, -30, 100); clock(6, 30); setSector(2,2,1,2); plot.fillText('早餐', -20, -30, 100); clock(7, 0); setSector(2,2,2,1); plot.fillText('早班', -20, -30, 100); clock(8, 30); setSector(2,2,2,2); plot.fillText('午餐', -20, -30, 100); clock(12, 30); */ setSector(2,2,1,1); plot.fillText('午班', -20, -30, 100); clock(13, 30); setSector(2,2,1,2); plot.fillText('晚餐', -20, -30, 100); clock(18, 0); setSector(2,2,2,1); plot.fillText('娱乐', -20, -30, 100); clock(19, 0); setSector(2,2,2,2); plot.fillText('休息', -20, -30, 100); clock(20, 30);</span>
就可以得到我小伟的一天了。
星历2015年12月19日 15:02:16, [机器小伟]说:[阿伟大人],来看看小伟的一天吧。
15:03:10, 接着,小伟又看了一会修炼功法的其它部分
还有这个:
以小伟的无极限智商来说,学会这些还真是轻松快乐。
本节到此结束,欲知后事如何,请看下回分解。
相关文章推荐
- java 与c#比较
- xcode用户界面概述
- Block中weakSelf的使用
- 初学web开发需要掌握哪些知识
- 测试人员的问题分析能力
- 图片预加载小记
- 破解 “PEDIY CrackMe 2007” 之 k4n
- 网红是完全从草根中产 的一群明星
- windbg kp kb 命令测试
- 【转】tomcat下部署 solr 5.3.1
- cell的各种使用和赋值 总结
- 体胖还需勤锻炼,人丑就要多读书
- javascript精确统计网站访问量实例代码
- mipmap和drawable区别
- openjudge GoperII
- Bmob中的几种查询方法
- PHP程序中使用adodb连接不同数据库的代码实例
- python标准库urllib2使用细节
- List.contains(Object o) 问题
- Qt遇到奇怪的问题--FTH