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

易语言如何做浏网站大尺寸图网站

易语言如何做浏网站,大尺寸图网站,广南网站制作,wordpress cia易验证效果 实现方式 计时器#xff1a;setTimeout或setInterval来计时。setInterval和 setTimeout 在某些情况下可能会出现计时不准确的情况。这通常是由于JavaScript的事件循环机制和其他代码执行所需的时间造成的。 问询#xff1a;通过getCurrentLight将每个状态的持续时间设置…效果 实现方式 计时器setTimeout或setInterval来计时。setInterval和 setTimeout 在某些情况下可能会出现计时不准确的情况。这通常是由于JavaScript的事件循环机制和其他代码执行所需的时间造成的。 问询通过getCurrentLight将每个状态的持续时间设置为精确的值并使用requestAnimationFrame来递归调用getCurrentLight函数我们可以更准确地控制交通灯的状态。 源码 index.html !DOCTYPE html htmlheadtitle交通灯/titlelink typetext/css relstyleSheet href./index.css //headbodydiv classtraffic-lightdiv classtraffic-containerdiv classlight green/divdiv classlight yellow/divdiv classlight red/div/divdiv classtime90/div/divscript typemoduleimport {TrafficLight} from ./TrafficLight.js;const time document.querySelector(.time);const trafficDom document.querySelector(.traffic-light);const light new TrafficLight({red:3,yellow:2,green:5,initial:red,});function raf(){requestAnimationFrame((){raf();const current light.getCurrentLight();time.textContent current.remain;trafficDom.className traffic-light ${current.color};console.log(current.color,current.remain);})}raf();/script/body /htmlindex.css * {margin: 0;padding: 0;box-sizing: border-box; }body{width: 100vw;height: 100vh;margin: 0;/* backgroud: #191c29 */background: #fff; }.traffic-light{width: 200px;margin: 10px auto;-webkit-box-flex: inherit;text-align: center; }.light{width: 20px;height: 20px;border-radius: 10px;display:inline-block;background-color: gray;margin: 10px auto; }.red .red{background-color: red; }.green .green{background-color: green; } .yellow .yellow{background-color: yellow; }.time{font-family: DS-Digital;font-size: 40px; }TrafficLight.js export class TrafficLight {constructor(options) {const {red 60,green 60,yellow 3,initial green,} options || {};this._colors {red:{seconds: red,next:yellow,},green:{seconds: green,next:yellow,},yellow:{seconds : yellow,},};this._switch(initial);}_switch(color){this._currentColor color;this._seconds this._colors[color].seconds;this._time Date.now();}_next(){if(this._currentColor red){this._colors.yellow.next green;} else if(this._currentColor green){this._colors.yellow.next red;} else{}this._switch(this._colors[this._currentColor].next); }getCurrentLight(){const remain Math.ceil(this._seconds -(Date.now() - this._time)/1000);if(remain0){this._next();return this.getCurrentLight();}return {color: this._currentColor,remain,};}}字体 DS-Digital 下载字体 DS-Digital 注意下载安装字体后需要重启浏览器才生效
http://wiki.neutronadmin.com/news/202760/

相关文章:

  • 安徽合肥企业网页制作公司网站优化的文章
  • 做动态影集的网站郑州app开发公司
  • 淘宝客源码程序 爱淘宝风格+程序自动采集商品 淘宝客网站模板iis网站拒绝显示此网页
  • 网站模板如何优化wordpress简
  • 无锡网站制作电话多少河南省建设厅网站103
  • 南城区仿做网站免费友情链接网页
  • 带导航栏的网站个人博客网站如何做SEO
  • 手机网站建设app网站备案证书放到哪里
  • 制作网站 公司简介桂林做网站公司
  • 肇庆网站制作案例特产网站建设的目的
  • 如何更换网站服务器免费做问卷的网站好
  • 个人网站有必要备案吗wordpress官方主题
  • 南岸网站关键词优化wordpress vue 关系
  • 送菜网站制作广西宏泰成建设集团网站
  • php网站怎么缓存做视频网站需要什么服务器配置
  • 网站优化含义html网站完整代码
  • 手机端便民服务平台网站建设南京工商注册核名查询系统
  • 自己怎么做响应式网站餐饮vi设计公司
  • 怎么做网站优化的聊城做网站做的不错的网络公司
  • 运城做网站重庆那里做网站外包好
  • 企业信用公示信息网知名seo网站优化公司
  • 软件网站开发设计做网站简单么
  • 如何在网站做引流建设厅投诉网站
  • 手机网站可以做动态吗培训网络营销的机构
  • 找人做软件去哪个网站找wordpress空间安装不了
  • 产品包装设计公司网站民治做网站哪家便宜
  • 电子商务网站调研报告株洲网站建设开发
  • 小视频网站开发网站建设的科目
  • 网站做公司简介怎么做自己做个网站怎么做
  • 广东在线网站建设服务器学生