漂亮实用鼠标跟随特效,光圈跟随鼠标轨迹运动显示,结合自己的网页布局和需求来修改这个特效即可使用。
<!DOCTYPE HTML> <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>很漂亮的跟随鼠标轨迹运动效果_武鸣人</title> <style type="text/css"> html { overflow: hidden; } body { position: absolute; height: 100%; width: 100%; margin:0; padding:0; } #screen_wuming_ren { background:#000; position: absolute; width: 100%; height: 100%; } #screen_wuming_ren span { background: #fff; font-size: 0; overflow: hidden; width: 2px; height: 2px; } </style> <script type="text/javascript"> var Follow = function () { var $ = function (i) {return document.getElementById(i)}, addEvent = function (o, e, f) {o.addEventListener ? o.addEventListener(e, f, false) : o.attachEvent('on'+e, function(){f.call(o)})}, OBJ = [], sp, rs, N = 0, m; var init = function (id, config) { this.config = config || {}; this.obj = $(id); sp = this.config.speed || 4; rs = this.config.animR || 1; m = {x: $(id).offsetWidth * .5, y: $(id).offsetHeight * .5}; this.setXY(); this.start(); }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) init.prototype = { setXY : function () { var _this = this; addEvent(this.obj, 'mousemove', function (e) { e = e || window.event; m.x = e.clientX; m.y = e.clientY; }) }, start : function () { var k = 180 / Math.PI, OO, o, _this = this, fn = this.config.fn; OBJ[N++] = OO = new CObj(null, 0, 0); for(var i=0;i<360;i+=20){ var O = OO; for(var j=10; j<35; j+=1){ var x = fn(i, j).x, y = fn(i, j).y; OBJ[N++] = o = new CObj(O , x, y); O = o; } } setInterval(function() { for (var i = 0; i < N; i++) OBJ[i].run(); }, 16); } }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) var CObj = function (p, cx, cy) { var obj = document.createElement("span"); this.css = obj.style; this.css.position = "absolute"; this.css.left = "-1000px"; this.css.zIndex = 1000 - N; document.getElementById("screen_wuming_ren").appendChild(obj); this.ddx = 0; this.ddy = 0; this.PX = 0; this.PY = 0; this.x = 0; this.y = 0; this.x0 = 0; this.y0 = 0; this.cx = cx; this.cy = cy; this.parent = p; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) CObj.prototype.run = function () { if (!this.parent) { this.x0 = m.x; this.y0 = m.y; } else { this.x0 = this.parent.x; this.y0 = this.parent.y; } this.x = this.PX += (this.ddx += ((this.x0 - this.PX - this.ddx) + this.cx) / rs) / sp; this.y = this.PY += (this.ddy += ((this.y0 - this.PY - this.ddy) + this.cy) / rs) / sp; this.css.left = Math.round(this.x) + 'px'; this.css.top = Math.round(this.y) + 'px'; }//武鸣人网站https://www.wuming.ren 网站很好记住,wuming.ren(武鸣拼音.ren域名后缀) return init; }(); </script></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> <div id="screen_wuming_ren"></div> <script type="text/javascript"> new Follow('screen_wuming_ren', {speed: 4, animR : 2, fn : function (i, j) { return { x : j/4*Math.cos(i), y : j/4*Math.sin(i) } }}) </script> </body> </html>
本文来自武鸣人网站,转载请注明出处