HTML5 3D衣服摇摆动画特效
这又是一款基于HTML5 Canvas的3D动画杰作,它是一个可以随风飘动的3D衣服摇摆动画特效,非常逼真。当我们将鼠标滑过衣服时,衣服将会出现摇摆的动画,点击鼠标时,衣服将会更加剧烈地摆动。 HTML代码 <div style="width:500px;margin:10px auto"> <canvas id="cv" width="480" height="300"></canvas> <p>"3D on 2D Canvas" demo</p> <p>move cursor to pan / click to swing</p> </div> P3D库JS代码,主要用来处理3D效果的 window.P3D = { texture: null, g: null }; P3D.clear = function(f, w, h) { var g = this.g; g.beginPath(); g.fillStyle = f; g.fillRect(0, 0, w, h); } P3D.num_cmp = function(a,b){return a-b;} P3D.drawTriangle = function(poss, uvs, shade_clr) { var w = this.texture.width; var h = this.texture.height; var