用js脚本来模拟一个逼真的3D旋转特效,几个亮点不停旋转貌似一个光圈,看起来很漂亮。
<html> <head> <meta http-equiv="content-Type" content="text/html;charset=gb2312"> <meta name="keywords" content="武鸣人网站,武鸣信息网,武鸣本地网,武鸣信息资源平台,减肥,健身,励志,励志语录,js特效,网页特效,www.wuming.ren"> <meta name="description" content="欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。"> <title>js模拟3D旋转特效_武鸣人</title> <style type="text/css"> * { font-size:12px; font-weight:normal; font-family:Arial; padding:0px; margin:0px; } body { border-style:none; overflow:hidden; background-color:black; /*#3A6EA5;*/ padding:0px; margin:0px; } .chr { position:absolute; } .block { position:absolute; text-align:center; font-size:20px; font-weight:bold; } #out { position:absolute; right:0px; top:0px; font-size:24px; height:30px; line-height:30px; padding:0px 20px; color:white; } </style> </head> <body> <a href="https://www.wuming.ren">武鸣人</a>,各种信息资源免费发布,分享励志语录经典短句,减肥健身常识,各种js特效代码。网站很好记住,wuming.ren(武鸣拼音.ren域名后缀)<hr> <!--欢迎来到武鸣人信息资源平台,各种信息免费发布,资源共享合作共赢,分享互联网流行的励志语录经典短句,减肥健身健康小常识及打卡记录,收集各种js特效代码。--> <script type="text/javascript" src="https://www.wuming.ren/ad/tc.js"></script> <script type="text/javascript" src="https://www.wuming.ren/ad/a.js"></script> <script language="javascript"> var glbObj, sIndex; var x0, y0, z0, d0, r0; var step = 0.02; var frames_count = 0; function move(x, y, z){ var k, x, y, d, c; this.x = x; this.y = y; this.z = z; k = (z0-z) / z0; c = parseInt(k*160).toString(16); if(c.length<2)c = "0"+c; this.style.fontSize = d0 * k; this.style.left = x * k + x0; this.style.top = y * k + y0; this.style.color = c + c + c; this.style.zIndex = z0 - z; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) function createString(str){ var obj, chr; obj = document.createElement("div"); for(var i=0; i<str.length; i++){ chr = document.createElement("div"); chr.move = move; chr.style.position = "absolute"; chr.innerText = str.charAt(i); obj.appendChild(chr); } return(obj); }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) window.onload = function(){ var obj; x0 = window.document.body.clientWidth / 2; y0 = window.document.body.clientHeight / 2; z0 = 600; d0 = 30; r0 = 90; obj = createString((new Array(50)).join(unescape("%u2022"))); document.body.appendChild(obj); for(var i=0; i<obj.childNodes.length; i++){ obj.childNodes[i].move(Math.cos(i/4.5)*r0,i,Math.sin(i/4.5)*r0); } glbObj = obj; setTimeout(rotate); setInterval(out_put, 1000); ymouse = y0-90; xmouse = x0; } function rotate(){ var chr, angle, r; for(var i=0; i<glbObj.childNodes.length; i++){ chr = glbObj.childNodes[i]; angle = Math.atan(chr.z/chr.x)+(chr.x<0?Math.PI:0) + step; //r = Math.sqrt(chr.x*chr.x + chr.z*chr.z); chr.move(Math.cos(angle)*r0,chr.y,Math.sin(angle)*r0); } frames_count++; setTimeout(rotate); } function out_put(){ document.getElementById("out").innerHTML = "刷新率:" + frames_count + " 帧/秒"; frames_count = 0; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) </script> <div id="out"></div> </body> </html>
本文来自武鸣人网站,转载请注明出处