<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
        主站蜘蛛池模板: 99久久国产热无码精品免费| 免费成人在线视频观看| 成年性生交大片免费看| 亚洲福利一区二区精品秒拍| 三年片在线观看免费大全电影| 亚洲爆乳无码一区二区三区| 怡红院免费的全部视频| 好看的亚洲黄色经典| 亚洲а∨天堂久久精品| 黄色网址免费在线| 亚洲国产天堂久久久久久| 一级做a爰片性色毛片免费网站| 亚洲最大av无码网址| 最新亚洲卡一卡二卡三新区| 女人18毛片a级毛片免费| 瑟瑟网站免费网站入口| 久久精品国产精品亚洲| 国产一精品一AV一免费| 亚洲国产视频网站| 日本高清免费aaaaa大片视频| 免费夜色污私人影院网站| 亚洲精品成人网站在线观看| 一级毛片免费观看不卡视频| 亚洲AV无码专区在线亚| 大地资源中文在线观看免费版| 久久久亚洲精品视频| 一级成人a做片免费| 亚洲av色福利天堂| 亚洲免费综合色在线视频| 麻豆亚洲av熟女国产一区二| 日本XXX黄区免费看| 在线观看亚洲网站| 永久免费看mv网站入口| 亚洲一区二区三区高清视频| 国产成人精品123区免费视频| 久久精品无码专区免费| 中文亚洲AV片不卡在线观看| 最近中文字幕国语免费完整| 亚洲av无码成人精品区一本二本| 亚洲综合国产精品第一页| 91精品国产免费久久久久久青草|