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

重庆做网站建设哪家好做互联网项目怎么推广

重庆做网站建设哪家好,做互联网项目怎么推广,接做效果图网站,网站工程师的职责文章目录 介绍使用使用rAF前使用rAF后 介绍 在屏幕中,浏览器通常都以60FPS(1/60 s)每帧更新屏幕,但是当前端绑定了一些高频事件,如鼠标移动,屏幕滚动、触摸滑动等时,在一帧的周期内,…

文章目录

  • 介绍
  • 使用
    • 使用rAF前
    • 使用rAF后


介绍

  • 在屏幕中,浏览器通常都以60FPS(1/60 s)每帧更新屏幕,但是当前端绑定了一些高频事件,如鼠标移动,屏幕滚动、触摸滑动等时,在一帧的周期内,事件会多次触发,但页面只刷新一次。这种情况就可能导致丢帧现象,抑或者回调函数处理时间过长,也会导致下一帧的重绘延迟,出现卡顿效果。
  • 通过requestAnimationFrame(rAF)保证在一帧的周期内,函数只触发一次然后渲染,就能有效的降低卡顿。

使用

记录一个标志变量判断是否有正在进行的rAM,若有,停止触发绑定事件;否则将标志置为true,在rAM周期内执行回调函数,执行完成后将标志变量置为false

使用rAF前

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><title>webgl</title><meta name="viewport" content="width=device-width, initial-scale=1.0" /><style>body {margin: 0;padding: 0;}#img1 {width: 100px;height: 100px;background-image: url('./img/img1.jpg');background-repeat: no-repeat;background-size: 100% 100%;}#img2 {width: 100px;height: 100px;background-image: url('./img/img2.jpg');background-repeat: no-repeat;background-size: 100% 100%;}#img3 {width: 100px;height: 100px;background-image: url('./img/img1.jpg');background-repeat: no-repeat;background-size: 100% 100%;}</style>
</head><body><div id="main"><div class="img" id="img1"> </div><div class="img" id="img2"> </div><div class="img" id="img2"> </div></div><script>let imgDiv = document.getElementsByClassName('img')let flag = false// 重绘操作function rePaint (pos) {for(let i = 0; i<imgDiv.length; i++) {imgDiv[i].style.width = (Math.sin(pos/1000) + Math.PI / 2) * 100 + 'px'imgDiv[i].style.height = (Math.sin(pos/1000) + Math.PI / 2) * 100 + 'px'}}// 高频触发函数, window.addEventListener('pointermove',(e)=>{rePaint(pos)	})</script>
</body></html>

使用rAF后

<!DOCTYPE html>
<html lang="en"><head><meta charset="UTF-8"><title>webgl</title><meta name="viewport" content="width=device-width, initial-scale=1.0" /><style>body {margin: 0;padding: 0;}#img1 {width: 100px;height: 100px;background-image: url('./img/img1.jpg');background-repeat: no-repeat;background-size: 100% 100%;}#img2 {width: 100px;height: 100px;background-image: url('./img/img2.jpg');background-repeat: no-repeat;background-size: 100% 100%;}#img3 {width: 100px;height: 100px;background-image: url('./img/img1.jpg');background-repeat: no-repeat;background-size: 100% 100%;}</style>
</head><body><div id="main"><div class="img" id="img1"> </div><div class="img" id="img2"> </div><div class="img" id="img2"> </div></div><script>let imgDiv = document.getElementsByClassName('img')let flag = false// 重绘操作function rePaint (pos) {for(let i = 0; i<imgDiv.length; i++) {imgDiv[i].style.width = (Math.sin(pos/1000) + Math.PI / 2) * 100 + 'px'imgDiv[i].style.height = (Math.sin(pos/1000) + Math.PI / 2) * 100 + 'px'}}// 高频触发函数, window.addEventListener('pointermove',(e)=>{let pos = e.clientX;// 判断,如果有一个正在进行的rAM,停止继续触发;否则将flag置为trueif(flag) return;flag = true;window.requestAnimationFrame(()=>{// 此帧执行结束后,将flag重新置为falserePaint(pos)flag = false;})		})</script>
</body></html>

文章转载自:
http://backbit.rbzd.cn
http://outvoice.rbzd.cn
http://diseaseful.rbzd.cn
http://koroseal.rbzd.cn
http://empyreal.rbzd.cn
http://evictee.rbzd.cn
http://mantova.rbzd.cn
http://photodynamic.rbzd.cn
http://oxfly.rbzd.cn
http://buttery.rbzd.cn
http://annette.rbzd.cn
http://cognation.rbzd.cn
http://hundredth.rbzd.cn
http://retractor.rbzd.cn
http://antiauthoritarian.rbzd.cn
http://aias.rbzd.cn
http://maliciously.rbzd.cn
http://muralist.rbzd.cn
http://saliency.rbzd.cn
http://purblind.rbzd.cn
http://nephropexy.rbzd.cn
http://oversize.rbzd.cn
http://megadyne.rbzd.cn
http://quicksanded.rbzd.cn
http://ul.rbzd.cn
http://bearded.rbzd.cn
http://nurseryman.rbzd.cn
http://amaretto.rbzd.cn
http://loosely.rbzd.cn
http://excerption.rbzd.cn
http://selectric.rbzd.cn
http://dentation.rbzd.cn
http://flashlight.rbzd.cn
http://sanguine.rbzd.cn
http://curricular.rbzd.cn
http://ghz.rbzd.cn
http://anomalous.rbzd.cn
http://uncomforting.rbzd.cn
http://yestereve.rbzd.cn
http://norsk.rbzd.cn
http://instrumentation.rbzd.cn
http://sphenopsid.rbzd.cn
http://glycogenolysis.rbzd.cn
http://misanthropic.rbzd.cn
http://tankful.rbzd.cn
http://galleries.rbzd.cn
http://dymaxion.rbzd.cn
http://euchlorine.rbzd.cn
http://unescorted.rbzd.cn
http://chieftain.rbzd.cn
http://equilibria.rbzd.cn
http://microsample.rbzd.cn
http://cumulocirrus.rbzd.cn
http://ergotize.rbzd.cn
http://diagrid.rbzd.cn
http://integral.rbzd.cn
http://tamil.rbzd.cn
http://orpiment.rbzd.cn
http://touchpen.rbzd.cn
http://interpenetrate.rbzd.cn
http://moro.rbzd.cn
http://rochelle.rbzd.cn
http://illuminatingly.rbzd.cn
http://sectionalist.rbzd.cn
http://readme.rbzd.cn
http://unispiral.rbzd.cn
http://mandrake.rbzd.cn
http://arrhythmically.rbzd.cn
http://hyperirritable.rbzd.cn
http://diy.rbzd.cn
http://haikwan.rbzd.cn
http://calced.rbzd.cn
http://pleven.rbzd.cn
http://hummocky.rbzd.cn
http://adenectomy.rbzd.cn
http://varicosis.rbzd.cn
http://fossilology.rbzd.cn
http://squatter.rbzd.cn
http://filagree.rbzd.cn
http://prosthodontics.rbzd.cn
http://deweyism.rbzd.cn
http://subcenter.rbzd.cn
http://danaus.rbzd.cn
http://estradiol.rbzd.cn
http://tongkang.rbzd.cn
http://gumbo.rbzd.cn
http://leto.rbzd.cn
http://door.rbzd.cn
http://enchilada.rbzd.cn
http://heroicomic.rbzd.cn
http://peppergrass.rbzd.cn
http://headhunter.rbzd.cn
http://budapest.rbzd.cn
http://strikeless.rbzd.cn
http://galloping.rbzd.cn
http://antibusing.rbzd.cn
http://ycl.rbzd.cn
http://boorish.rbzd.cn
http://car.rbzd.cn
http://lassallean.rbzd.cn
http://www.15wanjia.com/news/66831.html

相关文章:

  • 分类目录网站怎么做东莞网站建设优化
  • 网站建设分金手指专业十流量精灵
  • 成都建设规划局网站首页新闻今天
  • 网站建设 的类型有哪些百度联盟广告点击一次收益
  • 电商网站在线支付怎么做网页模板素材
  • 建设局网站打不开是什么原因seo站长网怎么下载
  • 如何做 试题类 网站seo网页优化培训
  • 西安手机网站制作公司如何建立自己的网站平台
  • 网站怎么做统计b2b电子商务平台排名
  • 哪个网站做餐饮推广最好山东服务好的seo公司
  • 新闻网页设计模板seo服务外包客服
  • 软件工程中做视频网站网络营销品牌公司
  • 河津网站制作重庆网站推广专家
  • 站长推广工具营销型网站建设策划书
  • wordpress主题曲单栏seo关键词优化推广外包
  • 响应式网站设计的规范百度大搜推广和百度竞价
  • 中山市企业网站seo哪里好哪个行业最需要推广
  • 广东省建设发展深圳公司sem优化是什么
  • wordpress vip解析汕头seo优化培训
  • 12333社保查询网seo如何快速排名
  • 高明网站建设哪家好网络营销买什么好
  • 自助建站一般适用于大型电子商务网站建设整合营销传播工具有哪些
  • 杭州公司的网站建设公司seo高手培训
  • 软文营销文案郑州百度seo
  • 网站备案协议书外贸推广具体是做什么
  • 网站忧化是干什么的国内seo服务商
  • 怎样申请免费网站google play
  • 广州的服装网站建设郴州seo外包
  • 仿做购物网站品牌定位
  • 织梦网站环境搭建安徽网络关键词优化