<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)前位置: 首頁 - 科技 - 知識百科 - 正文

        CSS和JS實(shí)現(xiàn)唯美星空軌跡運(yùn)動效果

        來源:懂視網(wǎng) 責(zé)編:小OO 時間:2020-11-27 18:49:21
        文檔

        CSS和JS實(shí)現(xiàn)唯美星空軌跡運(yùn)動效果

        先給大家分享效果圖。給大家分享一個使用CSS+JS實(shí)現(xiàn)的唯美星空軌跡運(yùn)動效果,這樣的效果不輸給Flash。相關(guān)代碼如下:<。<。doctype html>;<;html lang=";en";>;<;head>;<;meta charset=";UTF-8";>;<;title>;cloth<;/title>;<;style>;body { background: #000;}img { display: block;float: left;margin: 0 1px 0 0;display: block;float: left;left: 0;top: 0;)。
        推薦度:
        導(dǎo)讀先給大家分享效果圖。給大家分享一個使用CSS+JS實(shí)現(xiàn)的唯美星空軌跡運(yùn)動效果,這樣的效果不輸給Flash。相關(guān)代碼如下:<。<。doctype html>;<;html lang=";en";>;<;head>;<;meta charset=";UTF-8";>;<;title>;cloth<;/title>;<;style>;body { background: #000;}img { display: block;float: left;margin: 0 1px 0 0;display: block;float: left;left: 0;top: 0;)。
        本文主要和大家分享一個使用CSS+JS實(shí)現(xiàn)的唯美星空軌跡運(yùn)動效果,效果非常逼真,下面小編給大家?guī)砹藢?shí)例代碼,需要的朋友參考下,希望能幫助到大家。

        先給大家分享效果圖:

        給大家分享一個使用CSS+JS實(shí)現(xiàn)的唯美星空軌跡運(yùn)動效果, 這樣的效果不輸給Flash 。相關(guān)代碼如下:

        <!doctype html>
        <html lang="en">
        <head>
         <meta charset="UTF-8">
         <title>cloth</title>
         <style>
         body {
         background: #000; 
        }
        img {
         display: block;
         float: left; 
         margin: 0 1px 0 0;
        }
        canvas {
         background: #131c35 linear-gradient(#192853, #131c35);
         display: block;
         float: left;
         /* uncomment to test overlay */
         /*
         position: absolute;
         left: 0;
         opacity: .5;
         top: 0;
         */ 
        }
         </style>
        </head>
        <body>
         <p id="container"></p>
         <script type="text/javascript" src="http://cdn.gbtags.com/jquery/1.11.1/jquery.min.js"></script>
         <canvas id="c"></canvas>
         <img src="http://dribbble.s3.amazonaws.com/users/36991/screenshots/674715/game.png" />
         <script>
         var c = document.getElementById('c'),
         ctx = c.getContext('2d'),
         cw = c.width = 400,
         ch = c.height = 300,
         rand = function(a,b){return ~~((Math.random()*(b-a+1))+a);},
         dToR = function(degrees){
         return degrees * (Math.PI / 180);
         },
         circle = {
         x: (cw / 2) + 5,
         y: (ch / 2) + 22,
         radius: 90,
         speed: 2,
         rotation: 0,
         angleStart: 270,
         angleEnd: 90,
         hue: 220,
         thickness: 18,
         blur: 25
         },
         particles = [],
         particleMax = 100,
         updateCircle = function(){
         if(circle.rotation < 360){
         circle.rotation += circle.speed;
         } else {
         circle.rotation = 0; 
         }
         },
         renderCircle = function(){
         ctx.save();
         ctx.translate(circle.x, circle.y);
         ctx.rotate(dToR(circle.rotation));
         ctx.beginPath();
         ctx.arc(0, 0, circle.radius, dToR(circle.angleStart), dToR(circle.angleEnd), true);
         ctx.lineWidth = circle.thickness; 
         ctx.strokeStyle = gradient1;
         ctx.stroke();
         ctx.restore();
         },
         renderCircleBorder = function(){
         ctx.save();
         ctx.translate(circle.x, circle.y);
         ctx.rotate(dToR(circle.rotation));
         ctx.beginPath();
         ctx.arc(0, 0, circle.radius + (circle.thickness/2), dToR(circle.angleStart), dToR(circle.angleEnd), true);
         ctx.lineWidth = 2; 
         ctx.strokeStyle = gradient2;
         ctx.stroke();
         ctx.restore();
         },
         renderCircleFlare = function(){
         ctx.save();
         ctx.translate(circle.x, circle.y);
         ctx.rotate(dToR(circle.rotation+185));
         ctx.scale(1,1);
         ctx.beginPath();
         ctx.arc(0, circle.radius, 30, 0, Math.PI *2, false);
         ctx.closePath();
         var gradient3 = ctx.createRadialGradient(0, circle.radius, 0, 0, circle.radius, 30); 
         gradient3.addColorStop(0, 'hsla(330, 50%, 50%, .35)');
         gradient3.addColorStop(1, 'hsla(330, 50%, 50%, 0)');
         ctx.fillStyle = gradient3;
         ctx.fill(); 
         ctx.restore();
         },
         renderCircleFlare2 = function(){
         ctx.save();
         ctx.translate(circle.x, circle.y);
         ctx.rotate(dToR(circle.rotation+165));
         ctx.scale(1.5,1);
         ctx.beginPath();
         ctx.arc(0, circle.radius, 25, 0, Math.PI *2, false);
         ctx.closePath();
         var gradient4 = ctx.createRadialGradient(0, circle.radius, 0, 0, circle.radius, 25);
         gradient4.addColorStop(0, 'hsla(30, 100%, 50%, .2)');
         gradient4.addColorStop(1, 'hsla(30, 100%, 50%, 0)');
         ctx.fillStyle = gradient4;
         ctx.fill(); 
         ctx.restore();
         },
         createParticles = function(){
         if(particles.length < particleMax){
         particles.push({
         x: (circle.x + circle.radius * Math.cos(dToR(circle.rotation-85))) + (rand(0, circle.thickness*2) - circle.thickness),
         y: (circle.y + circle.radius * Math.sin(dToR(circle.rotation-85))) + (rand(0, circle.thickness*2) - circle.thickness),
         vx: (rand(0, 100)-50)/1000,
         vy: (rand(0, 100)-50)/1000,
         radius: rand(1, 6)/2,
         alpha: rand(10, 20)/100
         });
         }
         },
         updateParticles = function(){
         var i = particles.length;
         while(i--){
         var p = particles[i];
         p.vx += (rand(0, 100)-50)/750;
         p.vy += (rand(0, 100)-50)/750;
         p.x += p.vx;
         p.y += p.vy;
         p.alpha -= .01;
         if(p.alpha < .02){
         particles.splice(i, 1)
         }
         }
         },
         renderParticles = function(){
         var i = particles.length;
         while(i--){
         var p = particles[i];
         ctx.beginPath();
         ctx.fillRect(p.x, p.y, p.radius, p.radius);
         ctx.closePath();
         ctx.fillStyle = 'hsla(0, 0%, 100%, '+p.alpha+')';
         }
         },
         clear = function(){
         ctx.globalCompositeOperation = 'destination-out';
         ctx.fillStyle = 'rgba(0, 0, 0, .1)';
         ctx.fillRect(0, 0, cw, ch);
         ctx.globalCompositeOperation = 'lighter'; 
         }
         loop = function(){
         clear();
         updateCircle();
         renderCircle();
         renderCircleBorder();
         renderCircleFlare();
         renderCircleFlare2();
         createParticles();
         updateParticles();
         renderParticles();
         }
        /* Append Canvas */
        //document.body.appendChild(c);
        /* Set Constant Properties */
        ctx.shadowBlur = circle.blur;
        ctx.shadowColor = 'hsla('+circle.hue+', 80%, 60%, 1)';
        ctx.lineCap = 'round'
        var gradient1 = ctx.createLinearGradient(0, -circle.radius, 0, circle.radius);
        gradient1.addColorStop(0, 'hsla('+circle.hue+', 60%, 50%, .25)');
        gradient1.addColorStop(1, 'hsla('+circle.hue+', 60%, 50%, 0)');
        var gradient2 = ctx.createLinearGradient(0, -circle.radius, 0, circle.radius);
        gradient2.addColorStop(0, 'hsla('+circle.hue+', 100%, 50%, 0)');
        gradient2.addColorStop(.1, 'hsla('+circle.hue+', 100%, 100%, .7)');
        gradient2.addColorStop(1, 'hsla('+circle.hue+', 100%, 50%, 0)');
        /* Loop It, Loop It Good */
        setInterval(loop, 16);
         </script>
        </body>
        </html>
         -

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

        文檔

        CSS和JS實(shí)現(xiàn)唯美星空軌跡運(yùn)動效果

        先給大家分享效果圖。給大家分享一個使用CSS+JS實(shí)現(xiàn)的唯美星空軌跡運(yùn)動效果,這樣的效果不輸給Flash。相關(guān)代碼如下:<。<。doctype html>;<;html lang=";en";>;<;head>;<;meta charset=";UTF-8";>;<;title>;cloth<;/title>;<;style>;body { background: #000;}img { display: block;float: left;margin: 0 1px 0 0;display: block;float: left;left: 0;top: 0;)。
        推薦度:
        標(biāo)簽: 運(yùn)動 js 效果
        • 熱門焦點(diǎn)

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 亚洲精品二三区伊人久久| 无码专区—VA亚洲V天堂| 亚洲午夜一区二区三区| 久草免费在线观看视频| 亚洲人成网站在线观看播放青青| 日本免费人成网ww555在线| 亚洲va久久久噜噜噜久久狠狠| 国产免费拔擦拔擦8X高清在线人| 久久亚洲精品中文字幕三区| 免费网站看av片| 亚洲毛片免费观看| 成人免费无码大片a毛片软件| 亚洲AV综合永久无码精品天堂 | 国产va免费精品| 亚洲精品无码专区久久久 | 三级毛片在线免费观看| 日韩亚洲欧洲在线com91tv| 久久精品毛片免费观看| 91亚洲国产成人久久精品| 毛片a级毛片免费播放下载 | 日韩视频在线观看免费| 亚洲综合成人网在线观看| 久久久久久久免费视频| 国产精品亚洲AV三区| 亚洲永久无码3D动漫一区| 8090在线观看免费观看| 亚洲人成电影网站免费| 亚洲狠狠爱综合影院婷婷| 国产精品免费一区二区三区四区| 亚洲色偷偷av男人的天堂| 国产精品成人四虎免费视频| 免费久久人人爽人人爽av | 亚洲成无码人在线观看| 好爽好紧好大的免费视频国产| 国产伦精品一区二区免费| 亚洲视频一区在线| 国产男女猛烈无遮挡免费视频网站 | 亚洲伊人久久大香线蕉啊| 亚洲 无码 在线 专区| 任你躁在线精品免费| 久久亚洲国产最新网站|