整合營銷服務(wù)商

          電腦端+手機端+微信端=數(shù)據(jù)同步管理

          免費咨詢熱線:

          剖析一個html5實例-風(fēng)車

          個特效包括兩個html, 一個命名為index.html,一個命名為index2.html

          index.html 源代碼如下:

          <!DOCTYPE html>

          <html lang="en" >

          <head>

          <meta charset="UTF-8">

          <title>純CSS3超逼真的風(fēng)車旋轉(zhuǎn)動畫DEMO演示</title>

          </head>

          <body>

          <div style="text-align:center;clear:both">

          <script src="/gg_bd_ad_720x90.js" type="text/javascript"></script>

          <script src="/follow.js" type="text/javascript"></script>

          </div>

          <iframe frameborder="0" scrolling="no" src="index2.html" width="100%" height="500px"></iframe>

          </body>

          </html>

          代碼講解:<body>里面包含兩個js文件負(fù)責(zé)交互。 嵌入一個frame ,指向index2.html,那么順著這個方向我們先看看index2.html,看看代碼的思路。

          <head>

          <meta charset="UTF-8">

          <title>純CSS3超逼真的風(fēng)車旋轉(zhuǎn)動畫DEMO演示</title>

          <link rel="stylesheet" >

          <link rel="stylesheet" href="css/style.css">

          </head>

          <body>

          <div class="window">

          <div class="windmill">

          <div class="pillar"></div>

          <div class="dome">

          <div class="dome-window"></div>

          </div>

          <div class="windmill-window"></div>

          <div class="blades">

          <div class="blade blade-1"></div>

          <div class="blade blade-2"></div>

          <div class="blade blade-3"></div>

          <div class="blade blade-4"></div>

          </div>

          <div class="ramp">

          <div class="grill"></div>

          <div class="hook hook-1"></div>

          <div class="hook hook-2"></div>

          <div class="hook hook-3"></div>

          <div class="hook hook-4"></div>

          </div>

          </div>

          <div class="sun"></div>

          <div class="land"></div>

          <div class="grass grass-1"></div>

          <div class="grass grass-2"></div>

          </div>

          從上面的代碼可以看出整個風(fēng)車是怎樣畫出來的。每一個div 里面都是風(fēng)車的組成部分。

          接下來我們選擇看一下css,是如何繪制的,這里看window的繪制

          .window {

          width: 540px;

          height: 540px;

          left: 50%;

          top: 50%;

          -webkit-transform-origin: 50% 50%;

          transform-origin: 50% 50%;

          -webkit-transform: translate(-50%, -50%) scale(1);

          transform: translate(-50%, -50%) scale(1);

          border-radius: 50%;

          background: radial-gradient(farthest-side at 135px 340px, var(--sky-color-2) 135px, transparent 135px), radial-gradient(farthest-side at 405px 300px, var(--sky-color-1) 140px, transparent 135px), linear-gradient(to bottom, var(--sky-color-1) 320px, var(--sky-color-2) 320px);

          -webkit-animation: window-move var(--window-move-time) ease-in-out infinite alternate;

          animation: window-move var(--window-move-time) ease-in-out infinite alternate;

          }

          ?按照以上的思路就可以串聯(lián)起整個風(fēng)車內(nèi)部的顏色,位置的繪制。

          果圖來一張,跨年兩個字這樣子扣的:我發(fā)現(xiàn)在PS里面用通道扣一些高對比度的圖片真的很爽

          后面是雪花效果,前面兩張圖片,加一個倒計時

          沒有廢話的時間了,直接上干貨吧:

          1, HTML的話,先得有一個`index.html`這樣子的網(wǎng)頁吧,新建一個文本文件,重命名成`index.html`就好了。然后寫進去最最簡單的HTML5的結(jié)構(gòu):

          <!DOCTYPE html>
          <html lang="zh" >
          <head>
          <meta charset="UTF-8">
          <title>祝大家2019年一切順利</title>
          <meta name="viewport" content="width=device-width, initial-scale=1">
          </head>
          <body>
          </body>
          </html>
          

          如果官網(wǎng)用記事本來寫這個網(wǎng)頁的話,得存成utf-8編碼的:

          另存為,在編碼里面選擇utf-8

          還是建議換一個好用一點的文本編輯器,我用的ee(EverEdit),還推薦使用Gvim、sublime這些。記事本的話,有點太簡單了。

          2, 在`</head>`前面一行加入css的引用:

          <meta name="viewport" content="width=device-width, initial-scale=1">
          <link rel="stylesheet" href="css/style.css">
          </head>
          

          相應(yīng)地,還需要在當(dāng)前目錄下面新建一個叫做`css`的文件夾,再在里面新建一個文本文件,并重命名為`style.css`,

          3, 在`</body>`的前面一行加入一個繪圖標(biāo)簽`<canvas>`:

          <canvas></canvas>
          </body>
          

          `<canvas>`標(biāo)簽算得上HTML5最有廣闊創(chuàng)造空間的標(biāo)簽之一了,可以通過js在`<canvas>`里面實現(xiàn)各種很不可思議的效果。

          4, 還是在`</body>`的前面,加入javascript的引用:

          <canvas></canvas>
          <script src="js/index.js"></script>
          </body>
          

          同樣的方法,在當(dāng)前文件夾下面新建`js`文件夾,再新建`index.js`文件。

          5, 往`index.js`里面加入實現(xiàn)雪花效果的代碼庫,在這里先只是貼出來,具體js實現(xiàn)講解,請聽下回分解。

          ;!( function( w, d ) {
           'use strict';
           var Snow = function( x, y, r, sx, sy, o ) {
           this.x = x;
           this.y = y;
           this.r = r;
           this.sx = sx;
           this.sy = sy;
           this.o = o;
           this.draw = function() {
           ctx.beginPath();
           ctx.arc( this.x, this.y, this.r, 0, 2 * Math.PI );
           ctx.fillStyle = 'rgba( 255, 255, 255, ' + this.o + ' )';
           ctx.fill();
           }
           this.update = function() {
           if ( this.x + this.r > cw )
           this.x = 0;
           if ( this.y + this.r > ch )
           this.y = 0;
           if ( my && this.y + conf.sense >= my && this.y <= my + conf.sense )
           this.x += this.sx;
           if ( mx && this.x + conf.sense >= mx && this.x <= mx + conf.sense )
           this.y += this.sy;
           this.x += this.sx;
           this.y += this.sy;
           }
           },
           anim = t => {
           let l = len;
           ctx.clearRect( 0, 0, cw, ch );
           while ( l-- ) {
           items[ l ].draw();
           items[ l ].update();
           }
           animID = requestAnimationFrame( anim );
           },
           init = () => {
           items = [];
          			len = cw > 1000 ? 2000 : cw < 500 ? 500 : 1000;
           for ( let i = 0; i < len; i++ ) {
           let r = Math.round( ( Math.random() * ( conf.maxR - conf.minR ) ) + conf.minR ),
           x = Math.round( ( Math.random() * ( cw + r ) ) - ( r * 2 ) ),
           y = Math.round( ( Math.random() * ( ch + r ) ) - ( r * 2 ) ),
           o = ( Math.random() * ( conf.maxO - conf.minO ) + conf.minO ).toFixed( 2 ),
           sx = Math.ceil( ( Math.random() * ( conf.maxS - conf.minS ) ) + conf.minS ),
           sy = Math.ceil( ( Math.random() * ( conf.maxS - conf.minS ) ) + conf.minS );
           items.push( new Snow( x, y, r, sx, sy, o ) );
           }
           animID = requestAnimationFrame( anim );
           },
           c = d.querySelector( 'canvas' ),
           ctx = c.getContext( '2d' ),
           conf = {
           maxR: 5,
           minR: 1,
           maxS: 2,
           minS: 0.3,
           maxO: 1,
           minO: .3,
           sense: 70
           },
           animID,
           timeoutID,
           mx = false,
           my = false,
           cw = innerWidth,
           ch = innerHeight,
           items = [],
           len = cw > 1000 ? 2000 : cw < 500 ? 500 : 1000;
           c.width = cw;
           c.height = ch;
           w.onresize = e => {
           if ( timeoutID )
           clearTimeout( timeoutID );
           timeoutID = setTimeout( () => {
           cw = innerWidth;
           	ch = innerHeight;
           c.width = cw;
           c.height = ch;
           if ( animID )
           cancelAnimationFrame( animID );
           init();
           }, 250 );
           };
           init();
           w.onmousemove = e => {
           mx = e.x;
           my = e.y;
           }
           w.onmouseout = e => {
           mx = false;
           my = false;
           }
          })( this, document );
          

          同樣地保存成為utf-8編碼格式,現(xiàn)在先把javascript這塊放到一邊。

          5, 現(xiàn)在已經(jīng)實現(xiàn)了雪花效果了,因為網(wǎng)頁的背景默認(rèn)是白的,而雪花也是白的,所以看不見雪花。 編輯`css/style.css`文件,修改網(wǎng)頁的背景為黑色:

          html, body {
           margin: 0;
           background: black;
          }
          

          好了,現(xiàn)在看到的網(wǎng)頁效果應(yīng)該是這個樣子的:

          雪花效果已經(jīng)實現(xiàn)

          接下來,將兩張圖片進行布局,再加入倒計時,就完美啦。因為時間原因,今天就先到這里,后面的效果明天繼續(xù)。

          (未完待續(xù))

          TML5 文件上傳下載的實例代碼,WEBUPLOADER之大文件分段上傳、斷點續(xù)傳,HTML DOM INPUT FILE 大文件上傳源代碼,B/S大附件上傳,支持?jǐn)帱c續(xù)傳,VUE處理文件流實現(xiàn)上傳下載,VUE 上傳大型文件插件(VUE上傳視頻插件)

          之前在網(wǎng)上也搜索過相關(guān)的資料,在論壇里面也與網(wǎng)絡(luò)交流過,但是給出的方案都不太令人滿意。一方面論壇里面的網(wǎng)頁都沒有真實的項目經(jīng)驗。幾乎大部分的網(wǎng)頁都是在紙上談兵,很多問題完全是憑想象在回答。也不能夠提供真實案例,基本上都沒有項目的實戰(zhàn)經(jīng)驗。

          甚至有些學(xué)生也在里面不知道從哪里復(fù)制的一些代碼然后粘貼在上面。

          后端PHP5,PHP6,PHP7,PHP8,ThinkPHP,

          服務(wù)器支持Linux,Windows,macOS,CentOS,中標(biāo)麒麟,銀河麒麟,統(tǒng)信,龍芯,華為鯤鵬,

          數(shù)據(jù)庫支持MySQL,達夢數(shù)據(jù)庫,人大金倉

          需要提供前端源碼,后端源碼,控件源碼

          需要提供7*24小時技術(shù)支持,長期技術(shù)支持,長期維護服務(wù)

          需要提供手機,QQ,微信,企業(yè)微信,電子郵箱等聯(lián)系方式

          需要支持包含IE在內(nèi)的全部瀏覽器

          終端需要支持Windows,macOS,Linux,信創(chuàng)國產(chǎn)化環(huán)境,中標(biāo)麒麟,銀河麒麟,統(tǒng)信UOS,龍芯,華為

          功能需要支持10G,50G,100G大文件上傳和斷點續(xù)傳,刷新續(xù)傳,重啟續(xù)傳

          文件夾包含1W,10W,100W個文件和層級結(jié)構(gòu)

          支持超大文件分片,分段,分塊,分割上傳下載,斷點續(xù)傳

          支持文件夾上傳,下載斷點續(xù)傳,支持文件夾層級結(jié)構(gòu),層級結(jié)構(gòu)信息保存到數(shù)據(jù)庫,下載的時候同樣保留層級結(jié)構(gòu)

          支持加密上傳,下載加密,端到端加密,國密SM4加密算法,數(shù)據(jù)加密傳輸,傳輸過程中要保證數(shù)據(jù)是加密的。1.下載示例

          https://gitee.com/xproer/up6-vue-cli



          將up6組件復(fù)制到項目中

          示例中已經(jīng)包含此目錄



          1.引入up6組件



          2.配置接口地址

          接口地址分別對應(yīng):文件初始化,文件數(shù)據(jù)上傳,文件進度,文件上傳完畢,文件刪除,文件夾初始化,文件夾刪除,文件列表

          參考:http://www.ncmem.com/doc/view.aspx?id=e1f49f3e1d4742e19135e00bd41fa3de



          3.處理事件



          啟動測試



          啟動成功



          效果



          數(shù)據(jù)庫



          源碼工程文檔:https://drive.weixin.qq.com/s?k=ACoAYgezAAw1dWofra

          源碼報價單:https://drive.weixin.qq.com/s?k=ACoAYgezAAwoiul8gl

          OEM版報價單:https://drive.weixin.qq.com/s?k=ACoAYgezAAwuzp4W0a

          控件源碼下載:https://drive.weixin.qq.com/s?k=ACoAYgezAAwbdKCskc


          主站蜘蛛池模板: 免费萌白酱国产一区二区| 国产成人一区二区在线不卡 | 国产福利无码一区在线| 中文字幕精品一区二区日本| 国产成人精品无人区一区| 亚洲精品精华液一区二区| 秋霞无码一区二区| 亚洲成在人天堂一区二区| 亚洲国产综合无码一区| 国产精品亚洲产品一区二区三区| 国产精品久久无码一区二区三区网 | 好爽毛片一区二区三区四| 欧洲精品一区二区三区| 一区二区三区精密机械| 亚洲一区二区三区国产精品无码 | 国产综合视频在线观看一区 | 一本岛一区在线观看不卡| 国产萌白酱在线一区二区| 精品日韩一区二区| 国产综合精品一区二区| 国偷自产视频一区二区久| 国产第一区二区三区在线观看 | 国产亚洲综合一区二区三区| 免费精品一区二区三区在线观看| 99精品一区二区三区无码吞精| 久久久精品人妻一区亚美研究所 | 国产主播一区二区三区| 亚洲av永久无码一区二区三区| 亚洲一区欧洲一区| 尤物精品视频一区二区三区| 日本免费一区二区三区最新| 国产麻豆媒一区一区二区三区| 国产一区二区三区在线电影| 色一情一乱一伦一区二区三区| 国产裸体舞一区二区三区| 人成精品视频三区二区一区 | 国产精品va无码一区二区| 日本精品一区二区三区在线观看| 日韩亚洲一区二区三区| 日韩精品一区二区三区中文精品| 国产精品第一区揄拍|