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

网站上传 404网络教学网站建设

网站上传 404,网络教学网站建设,一般通过什么来进行知识点挖掘,做缓网站效果 实现方式 计时器#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://www.yutouwan.com/news/249580/

相关文章:

  • 页面设计模板网站给网站网站做优化
  • 优质做网站价格如何在家里做网站
  • 有没有好用的网站推荐建筑网格
  • 水墨风格网站自己想做网站
  • 两学一做网站专栏哪个平台可以定制衣服
  • 网站设置搜索关键字郑州投资网站建设
  • 域名做违法网站ppt超链接网站怎么做
  • 做网站的必备软件采招网
  • 哪个网站做供求信息中国建设银行的网站首页
  • html5在网站建设中的凡科建站怎么收费
  • 九江网站建设网站制作网站制作一键生成
  • 中国建设劳动学会官方网站wordpress固定链接中文
  • 泉州专业做网站汽车网站
  • 如何创建自己的网站平台wordpress自定义模块自定义字段
  • 顶客网站和网摘网站科技类网站
  • 网站怎么做才能让更多平台展现红色大气网站
  • 人力资源公司的业务范围福州百度推广优化排名
  • php 网站调试昆山网站建设公司哪家好
  • 网站由哪三部分组成wordpress主题文件夹在哪里
  • 广州做网站市场青岛市做网站
  • 西安个人网站建设龙岗免费的网站制作
  • 中国信用网站建设的重要性深圳网站建设深圳网络公司
  • 做网站设计的有些什么职位网站建设在作用是什么
  • 摄影作品可以在哪些网站投稿快速网站仿制
  • 国内有做外汇的正规网站吗如何新建一个网站
  • 如今做哪个网站致富重庆sem网站推广
  • 网站怎么做动效网站百度地图怎么做
  • 公司网站建设需要显示什么数据分析师就业前景如何
  • 网站推广是什么岗位有哪些网页设计公司
  • 泰安最好的网站建设公司河南 医院 网站建设