当前位置: 首页 > news >正文

企业网站的建设目标有哪几种常州市网站建设公司

企业网站的建设目标有哪几种,常州市网站建设公司,如何制作企业网站,网站建设图片教程视频教程目录 实时时钟1. 绘制静态秒针2. 秒针的转动3. 根据实际时间转动4. 添加时针和分针5. 添加表盘刻度 实时时钟 本博客介绍利用EasyX实现一个实时钟表的小程序#xff0c;同时学习时间函数的使用。 本文源码可从github获取 1. 绘制静态秒针 第一步定义钟表的中心坐标center同时学习时间函数的使用。 本文源码可从github获取 1. 绘制静态秒针 第一步定义钟表的中心坐标center它也是秒针的起点定义秒针的长度secondLength、秒针的终点坐标secondEnd利用setlinestyle函数设定线的型号和宽度调用line函数绘制秒针。 #include graphics.h #include conio.h #include cmathusing namespace std;struct Point {int x;int y; };#define High 480 #define Width 640int main(void) {initgraph(Width, High);Point center, secondEnd;center.x Width / 2;center.y High / 2;int sencondLenth Width / 5;secondEnd.x center.x sencondLenth;secondEnd.y center.y;// 画秒针setlinestyle(PS_SOLID, 2); // 画实线宽度为2个像素setcolor(WHITE);line(center.x, center.y, secondEnd.x, secondEnd.y);_getch();closegraph();return 0; }2. 秒针的转动 第二步实现秒针的转动定义secondAngle为秒针对应的角度利用三角几何知识求出秒针的终点坐标 secondEnd.x center.x secondLenth * sin(secondAngle); secondEnd.y center.y - secondLenth * cos(secondAngle); 让角度循环变化则实现了秒针转动的动画效果。 #include graphics.h #include conio.h #include cmathusing namespace std;struct Point {int x;int y; };#define High 480 #define Width 640 #define PI 3.1415926int main(void) {initgraph(Width, High);Point center, secondEnd;center.x Width / 2;center.y High / 2;int secondLenth Width / 5;secondEnd.x center.x secondLenth;secondEnd.y center.y;double secondAngle 1.0; while (true){// 由角度决定终点坐标secondEnd.x center.x secondLenth * sin(secondAngle);secondEnd.y center.y - secondLenth * cos(secondAngle);// 画秒针setlinestyle(PS_SOLID, 2); // 画实线宽度为2个像素setcolor(WHITE);line(center.x, center.y, secondEnd.x, secondEnd.y);Sleep(100);setcolor(BLACK);line(center.x, center.y, secondEnd.x, secondEnd.y);// 秒针角度变化secondAngle secondAngle * 2 * PI / 60 1;}_getch();closegraph();return 0; }3. 根据实际时间转动 第三步定义系统变量(SYSTEMTIME ti)通过GetLocalTime(ti)获取当前时间秒针的角度由实际时间决定即secondAngle ti.wSecond * 2 * PI/60。 #include graphics.h #include conio.h #include cmathusing namespace std;struct Point {int x;int y; };#define High 480 #define Width 640 #define PI 3.1415926int main(void) {initgraph(Width, High);Point center, secondEnd;center.x Width / 2;center.y High / 2;int secondLenth Width / 5;secondEnd.x center.x secondLenth;secondEnd.y center.y;double secondAngle;SYSTEMTIME ti;while (true){GetLocalTime(ti);secondAngle ti.wSecond * 2 * PI / 60;// 由角度决定终点坐标secondEnd.x center.x secondLenth * sin(secondAngle);secondEnd.y center.y - secondLenth * cos(secondAngle);// 画秒针setlinestyle(PS_SOLID, 2); // 画实线宽度为2个像素setcolor(WHITE);line(center.x, center.y, secondEnd.x, secondEnd.y);Sleep(100);setcolor(BLACK);line(center.x, center.y, secondEnd.x, secondEnd.y);}_getch();closegraph();return 0; }4. 添加时针和分针 第四步添加时针、分针和秒针变化相比他们的长度、宽度、颜色、旋转速度有一定的不同。 #include graphics.h #include conio.h #include cmathusing namespace std;struct Point {int x;int y; };#define High 480 #define Width 640 #define PI 3.1415926int main(void) {initgraph(Width, High);Point center, secondEnd, minuteEnd, hourEnd;center.x Width / 2;center.y High / 2;int secondLenth Width / 5;int minuteLenth Width / 6;int hourLenth Width / 8;double secondAngle;double minuteAngle;double hourAngle;SYSTEMTIME ti;while (true){GetLocalTime(ti);secondAngle ti.wSecond * 2 * PI / 60;minuteAngle ti.wMinute * 2 * PI / 60;hourAngle (ti.wHour % 12) * 2 * PI / 12;// 由角度决定秒针终点坐标secondEnd.x center.x secondLenth * sin(secondAngle);secondEnd.y center.y - secondLenth * cos(secondAngle);// 由角度决定分针终点坐标minuteEnd.x center.x minuteLenth * sin(minuteAngle);minuteEnd.y center.y - minuteLenth * cos(minuteAngle);// 由角度决定时针终点坐标hourEnd.x center.x hourLenth * sin(hourAngle);hourEnd.y center.y - hourLenth * cos(hourAngle);// 画秒针setlinestyle(PS_SOLID, 2); // 画实线宽度为2个像素setcolor(WHITE);line(center.x, center.y, secondEnd.x, secondEnd.y);// 画分针setlinestyle(PS_SOLID, 4); // 画实线宽度为4个像素setcolor(BLUE);line(center.x, center.y, minuteEnd.x, minuteEnd.y);// 画时针setlinestyle(PS_SOLID, 6); // 画实线宽度为6个像素setcolor(RED);line(center.x, center.y, hourEnd.x, hourEnd.y);Sleep(10); // 延时10毫秒setcolor(BLACK);setlinestyle(PS_SOLID, 2); // 画实线宽度为2个像素line(center.x, center.y, secondEnd.x, secondEnd.y);setlinestyle(PS_SOLID, 4); // 画实线宽度为4个像素line(center.x, center.y, minuteEnd.x, minuteEnd.y);setlinestyle(PS_SOLID, 6); // 画实线宽度为6个像素line(center.x, center.y, hourEnd.x, hourEnd.y);}int c _getch();closegraph();return 0; }5. 添加表盘刻度 第五步绘制表盘并可以利用outtextxy()函数在画面中输出文字为了让时针、分针的转动更自然对求解时针、分针的角度进行了改进。 #include graphics.h #include conio.h #include cmathusing namespace std;struct Point {int x;int y; };#define High 480 #define Width 640 #define PI 3.1415926int main(void) {initgraph(Width, High);Point center, secondEnd, minuteEnd, hourEnd;center.x Width / 2;center.y High / 2;int secondLenth Width / 5;int minuteLenth Width / 6;int hourLenth Width / 8;double secondAngle;double minuteAngle;double hourAngle;SYSTEMTIME ti;BeginBatchDraw();while (true){// 绘制一个简单的表盘setlinestyle(PS_SOLID, 1); // 画实线宽度为1个像素setcolor(WHITE);circle(center.x, center.y, Width / 4);// 画刻度int x, y, i;for (i 0; i 60; i){x center.x int(Width/4.3*sin(PI*2*i/60));y center.y - int(Width/4.3*cos(PI*2*i/60));if (i % 15 0) {bar(x - 5, y -5, x 5, y 5);}else if (i % 5 0) {circle(x, y, 3);}else {putpixel(x, y, WHITE);}}GetLocalTime(ti);secondAngle ti.wSecond * 2 * PI / 60;minuteAngle ti.wMinute * 2 * PI / 60 secondAngle / 60;hourAngle ti.wHour*2*PI/12 minuteAngle / 12;// 由角度决定秒针终点坐标secondEnd.x center.x secondLenth * sin(secondAngle);secondEnd.y center.y - secondLenth * cos(secondAngle);// 由角度决定分针终点坐标minuteEnd.x center.x minuteLenth * sin(minuteAngle);minuteEnd.y center.y - minuteLenth * cos(minuteAngle);// 由角度决定时针终点坐标hourEnd.x center.x hourLenth * sin(hourAngle);hourEnd.y center.y - hourLenth * cos(hourAngle);// 画秒针setlinestyle(PS_SOLID, 2); // 画实线宽度为2个像素setcolor(WHITE);line(center.x, center.y, secondEnd.x, secondEnd.y);// 画分针setlinestyle(PS_SOLID, 4); // 画实线宽度为4个像素setcolor(BLUE);line(center.x, center.y, minuteEnd.x, minuteEnd.y);// 画时针setlinestyle(PS_SOLID, 6); // 画实线宽度为6个像素setcolor(RED);line(center.x, center.y, hourEnd.x, hourEnd.y);FlushBatchDraw();Sleep(10); // 延时10毫秒setcolor(BLACK);setlinestyle(PS_SOLID, 2); // 画实线宽度为2个像素line(center.x, center.y, secondEnd.x, secondEnd.y);setlinestyle(PS_SOLID, 4); // 画实线宽度为4个像素line(center.x, center.y, minuteEnd.x, minuteEnd.y);setlinestyle(PS_SOLID, 6); // 画实线宽度为6个像素line(center.x, center.y, hourEnd.x, hourEnd.y);}EndBatchDraw();int c _getch();closegraph();return 0; }至此完成。
http://www.dnsts.com.cn/news/80690.html

相关文章:

  • 晋江建设银行招聘网站网站开发 北京外包公司
  • 北京建设公司网站兰州做网站公司
  • 深圳专业网站开发公司wordpress的第三方登录插件下载
  • 网站欢迎页面怎么做怎么做本地婚姻介绍网站
  • 主题网站的设计方案网页设计模板及代码
  • 宁波网站制作公司费用价格手机网站内容模块
  • 五百人建站网站建设与管理心得体会
  • 烟台做网站的公司淄博做网站跟优化
  • 网站谁家做得好手机网站建设多少钿
  • 旅游网站制作过程高德地图能在国外用吗
  • 专业做二手房的网站有哪些wordpress 主题 数据库
  • 做网站怎么申请百度推广广西企业建站
  • 网站推广营销运营方式长沙网站seo诊断
  • 政务网站开发协议双滦区seo整站排名
  • 长春网站建设方案报价网站建设业务开展方案
  • 刚做的网站怎么才能搜索到湖北工程公司建设公司网站
  • 网站规划的原则有可以分为()
  • 做网站密云新浪云能用wordpress
  • 点胶机 东莞网站建设龙岩网站制作设计
  • 曲阜网站建设asp.net 登陆两个网站
  • 大型网站建设多少钱公司企业管理
  • 海口网站如何制作win7如何做网站
  • 广东网站备案网站建设 网站运营
  • 常州网络推广网站网站为何改版
  • wordpress做网站手机做网站商业计划书范文
  • 手机做网站软件高端的咨询行业网站设计
  • 《电子商务网站建设 》求个网站好人有好报2023
  • 企业建设网站项目背景免费软件有版权吗
  • 商盈网站建设网站建设项目前景
  • wordpress主题站商业网站开发实训总结