<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當(dāng)前位置: 首頁 - 科技 - 知識(shí)百科 - 正文

        使用JS實(shí)現(xiàn)氣泡跟隨鼠標(biāo)移動(dòng)的動(dòng)畫效果

        來源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-27 22:29:58
        文檔

        使用JS實(shí)現(xiàn)氣泡跟隨鼠標(biāo)移動(dòng)的動(dòng)畫效果

        使用JS實(shí)現(xiàn)氣泡跟隨鼠標(biāo)移動(dòng)的動(dòng)畫效果:氣泡跟隨鼠標(biāo)移動(dòng),并在每次點(diǎn)擊時(shí)產(chǎn)生不同的變化 效果如下 <!DOCTYPE html> <html lang=en> <head> <meta http-equiv=Content-Type content=text/html; charset=utf-8 /> &
        推薦度:
        導(dǎo)讀使用JS實(shí)現(xiàn)氣泡跟隨鼠標(biāo)移動(dòng)的動(dòng)畫效果:氣泡跟隨鼠標(biāo)移動(dòng),并在每次點(diǎn)擊時(shí)產(chǎn)生不同的變化 效果如下 <!DOCTYPE html> <html lang=en> <head> <meta http-equiv=Content-Type content=text/html; charset=utf-8 /> &

        氣泡跟隨鼠標(biāo)移動(dòng),并在每次點(diǎn)擊時(shí)產(chǎn)生不同的變化

        效果如下

        <!DOCTYPE html>
        <html lang="en">
         <head>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
         <title>
        簡(jiǎn)單的氣泡效果
        </title>
         <style type="text/css">
         body{background-color:#000000;margin:0px;overflow:hidden}
         </style>
         </head>
         <body>
         </body>
        </html>
        <script>
         var canvas = document.createElement('canvas'),
         context = canvas.getContext('2d'),
         windowW = window.screen.width ,
         windowH = window.screen.height ,
         Mx,
         My,
         paused = true;
         suzu = [];
         booms = [];
         boomks = [];
         start();
         canvas.onmousemove = function(e) {
         var loc = canvasMove(e.clientX, e.clientY);
         Mx = loc.x;
         My = loc.y
         };
         canvas.onmousedown = function() {
         creatarry(Mx, My);
         paused = !paused
         };
         function creatarry(a, b) {
         for (var i = 0; i < 40; ++i) {
         booms[i] = {
         x: a,
         y: b,
         gravity: 0.3,
         speedX: Math.random() * 20 - 10,
         speedY: Math.random() * 15 - 7,
         radius: Math.random() * 15,
         color: Math.random() * 360,
         apc: 0.6
         };
         boomks.push(booms[i]);
         if (boomks.length > 300) {
         boomks.shift()
         };
         console.log(boomks)
         }
         };
         function loop1() {
         boomks.forEach(function(circle) {
         context.beginPath();
         context.arc(circle.x, circle.y, circle.radius, 0, Math.PI * 2, false);
         context.fillStyle = 'hsla(' + circle.color + ',100%,60%,' + circle.apc + ')';
         context.fill();
         movecircles(circle)
         })
         }
         function movecircles(circle) {
         circle.x += circle.speedX;
         circle.speedY += circle.gravity;
         circle.y += circle.speedY;
         circle.apc -= 0.008
         }
         function canvasMove(x, y) {
         var bbox = canvas.getBoundingClientRect();
         return {
         x: x - bbox.left * (canvas.width / bbox.width),
         y: y - bbox.top * (canvas.height / bbox.height)
         }
         };
         function start() {
         document.body.appendChild(canvas);
         canvas.width = windowW;
         canvas.height = windowH;
         setInterval(fang, 25)
         }
         function fang() {
         context.clearRect(0, 0, canvas.width, canvas.height);
         loop1();
         loop()
         }
         function loop() {
         var circle = new createCircle(Mx, My);
         suzu.push(circle);
         for (i = 0; i < suzu.length; i++) {
         var ss = suzu[i];
         ss.render(context);
         ss.update()
         }
         if (suzu.length > 1000) {
         suzu.shift()
         }
         }
         function createCircle(x, y) {
         this.x = x;
         this.y = y;
         this.color = Math.random() * 360;
         this.radius = Math.random() * 25;
         this.xVel = Math.random() * 5 - 2;
         this.apc = 0.6;
         this.gravity = 0.07;
         this.yVel = Math.random() * 10 - 3;
         this.render = function(c) {
         c.beginPath();
         c.arc(this.x, this.y, this.radius, 0, Math.PI * 2, true);
         c.fillStyle = 'hsla(' + this.color + ',100%,60%,' + this.apc + ')';
         c.fill()
         };
         this.update = function() {
         if (!paused) {
         this.yVel += this.gravity;
         this.y += this.yVel
         } else {
         this.y -= 5
         }
         this.x += this.xVel;
         this.apc -= 0.01;
         if (this.radius > 1) {
         this.radius -= 0.4
         }
         } }
         </script>

        總結(jié)

        以上所述是小編給大家?guī)砹耸褂肑S實(shí)現(xiàn)氣泡跟隨鼠標(biāo)移動(dòng)的動(dòng)畫效果 ,希望對(duì)大家有所幫助!

        聲明:本網(wǎng)頁內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        使用JS實(shí)現(xiàn)氣泡跟隨鼠標(biāo)移動(dòng)的動(dòng)畫效果

        使用JS實(shí)現(xiàn)氣泡跟隨鼠標(biāo)移動(dòng)的動(dòng)畫效果:氣泡跟隨鼠標(biāo)移動(dòng),并在每次點(diǎn)擊時(shí)產(chǎn)生不同的變化 效果如下 <!DOCTYPE html> <html lang=en> <head> <meta http-equiv=Content-Type content=text/html; charset=utf-8 /> &
        推薦度:
        • 熱門焦點(diǎn)

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 精品国产亚洲第一区二区三区| 无码一区二区三区亚洲人妻| 九九免费观看全部免费视频| 亚洲精品视频免费观看| 日本不卡免费新一区二区三区| 国产福利视精品永久免费| 免费无码又爽又刺激高潮的视频| jlzzjlzz亚洲乱熟在线播放| 久久亚洲美女精品国产精品| 亚洲精品GV天堂无码男同| 三级毛片在线免费观看| 免费看的一级毛片| 亚洲AV无码成人精品区日韩| 99re免费99re在线视频手机版| 亚洲第一黄片大全| 国产午夜亚洲精品国产| 午夜无码A级毛片免费视频| 亚洲国产成人精品91久久久| 成在线人直播免费视频| 好爽…又高潮了免费毛片| 久久综合九九亚洲一区| 黄页网址在线免费观看| 毛片基地免费视频a| 亚洲AV无码一区东京热久久| 一级做a爰全过程免费视频| 亚洲人成高清在线播放| 久久ww精品w免费人成| 亚洲国产精彩中文乱码AV| 国产亚洲精品欧洲在线观看| 野花高清在线观看免费3中文 | 四虎成人免费网址在线| 亚洲av综合日韩| 国产亚洲人成网站在线观看不卡| 久久精品国产亚洲av天美18| 亚洲综合av永久无码精品一区二区 | jizz18免费视频| 911精品国产亚洲日本美国韩国| 国产精品亚洲综合网站| 国产亚洲精品xxx| 午夜免费福利影院| 国内永久免费crm系统z在线 |