HTML5的动画学习历程
一.三角学原理.
function getRadio(d){//根据角度获得弧度,
return d*Math.PI/180;
},
function getDdegree(r){//根据弧度获得角度
return r*180/Math.PI;
二.循环动画方法的浏览器判断 }
if(!window.requestAnimationFrame){
window.requestAnimationFrame=(window.webkitRequestAnimationFrame||
window.mozRequestAnimationFrame||
window.oRequestAnimationFrame||
window.msRequestionFrame||
function(callback){return window.setTimeout(callback,100/60);}
);
}
三.获得元素坐标
var captureMouse=function(element){
var mouse={x:0,y:0};
element.addEventListener('mousemove',function(event){
var x,y;
if(event.pageX||event.pageY){
x=event.pageX;y=event.pageY;
}
else{
x=event.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;
y=event.clientY+document.body.scrollTop+document.documentElement.scrollTop;
}
x-=element.offsetLeft;
y-=element.offsetTop;
mouse.x=x;
mouse.y=y;
},false);
return mouse;
};
四.//将十六进制的色值转换成rgb格式
var colorToRGB=function(color,alpha){
if(typeof color==="string"&&color[0]==="#")
color=window.parseInt(color.slice(1),16);
alpha=(alpha===underfined)?1:alpha;
var r=color>>16&0xff,
g=color>>8&0xff,
b=color&0xff,
a=(alpha<0)?0:((alpha>1)?1:alpha);
if(a===1)
return "rgb("+r+","+g+","+b+")";
else
return "rgba("+r+","+g+","+b+","+a+")";
};
五//可以将一个颜色的数据值转换成十六进制,也可以将十六进制转换成数据
var parseColor=function(color,toNumber){
if(toNumber===true){
if(typeof color==='number')
return (color|0);
if(typeof color==='string'&&color[0]==='#')
color=color.slice(1);
return window.parseInt(color,16);
}
else{
if(typeof color==='number')
color='#'+('00000'+(color|0).toString(16)).substr(-6);
return color;
}
};
六.绘制箭头
(1)
function Arrow(){
this.x=0;
this.y=0;
this.color="#ffff00";
this.rotation=0;
}
Arrow.prototype.draw=function(context){
context.save();
context.translate(this.x,this.y);
context.rotate(this.rotation);
context.lineWidth=2;
context.fillStyle=this.color;
context.beginPath();
context.moveTo(-50,-25);
context.lineTo(0,-25);
context.lineTo(0,-50);
context.lineTo(50,0);
context.lineTo(0,50);
context.lineTo(0,25);
context.lineTo(-50,25);
context.lineTo(-50,-25);
context.closePath();
context.fill();
context.stroke();
context.restore();
};
绘制圆球
function Ball(radius,color){
if(radius===undefined){ radius=40;}
if(color==undefined){ color="#ff0000";}
this.x=0;this.y=0;
this.radius=radius;
this.rotation=0;
this.vx=0;//在边界和摩擦力上添加
this.vy=0;//在边界和摩擦力上添加
this.scaleX=1;
this.scaleY=1;
this.color=parseColor(color);
this.lineWidth=1;
}
Ball.prototype.draw=function(context){
context.save();
context.translate(this.x,this.y);
context.rotate(this.rotation);
context.scale(this.scaleX,this.scaleY);
context.lineWidth=this.lineWidth;
context.fillStyle=this.color;
context.beginPath();
context.arc(0,0,this.radius,0,(Math.PI*2),true);
context.closePath();
context.fill();
if(this.lineWidth>0){
context.stroke();
}
context.restore();
};
七.绘制各种基本动画
(1)window.onload=function(){
//平滑的上下运动
/*var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
mouse=captureMouse(canvas);
arrow=new Arrow();
arrow.x=canvas.width/2;
arrow.y=canvas.height/2;*/
/*(function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height);
var dx=mouse.x-arrow.x;
var dy=mouse.x-arrow.y;
arrow.rotation=Math.atan(dy,dx);
arrow.draw(context);
}())*/
}
(2)window.onload=function(){
//线性垂直运动
/*var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
ball=new Ball(),
angle=0;
var centerY=200;
var range=50;
var speed=0.05;
ball.x=canvas.width/2;
ball.y=canvas.height/2;
(function drawFram(){
window.requestAnimationFrame(drawFram,'canvas');
context.clearRect(0,0,canvas.width,canvas.height);
ball.y=centerY/2+Math.sin(angle)*50;
angle+=speed;
ball.draw(context);
}());
*/
}
(3)window.onload=function(){
//脉冲运动
/*var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
ball=new Ball(),
angle=0,
centerY=200,
range=50,
xspeed=1,
yspeed=0.05;
ball.x=0;
(function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height);
ball.x+=xspeed;
ball.y=centerY/2+Math.sin(angle)*range;
ball.draw(context);
}());*/
/*var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
ball=new Ball(),
angle=0,
centerScale=1,
range=0.5,
speed=0.05;
ball.x=canvas.widt/2;
ball.y=canvas.height/2;
(function drawFrame(){
window.requestAnimationFrame(drawFrame,context);
context.clearRect(0,0,canvas.width,canvas.height);
ball.scaleX=ball.scaleY=centerScale+Math.sin(angle)*range;
angle+=speed;
ball.draw(context);
}());*/
}
(4)window.onload=function(){
//使用两鞥波个角
/*var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
ball=new Ball(),
angleX=0,
angleY=0,
range=50,
centerX=canvas.width/2,
centerY=canvas.height/2,
xspeed=0.07,
yspeed=0.11;
(function drawFrame(){
window.requestAnimationFrame(drawFrame,context);
context.clearRect(0,0,canvas.width,canvas.height);
ball.x=centerX+Math.sin(angleX)*range;
ball.y=centerY+Math.sin(angleY)*range;
angleX+=xspeed;
angleY+=yspeed;
ball.draw(context);
}());*/
}
(5)window.onload=function(){//圆周运动
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d');
angle=0,range=50,
centerY=canvas.height/2,
xspeed=1,yspeed=0.05,
xpos=0,ypos=centerY;
context.lineWidth=2;
(function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.beginPath();
context.moveTo(xpos,ypos);
xpos+=xspeed;angle+=yspeed;
ypos=centerY+Math.sin(angle)*range;
context.lineTo(xpos,ypos);
context.stroke();
}());
}
(6) window.onload=function(){//椭圆运动
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d');
ball=new Ball(),
angle=0,
centerX=canvas.width/2,
centerY=canvas.height/2,
radius=50,
speed=0.05;
(function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height);
ball.x=centerX+Math.sin(angle)*radius;
ball.y=centerY+Math.cos(angle)*radius;
angle+=speed;
ball.draw(context);
}());}
(7)勾股定律中 连个随机出现的点的距离算法1
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d');
log=document.getElementById('log');
var rect1={x:Math.random()*canvas.width,y:Math.random()*canvas.height};
context.fillStyle="#000000";
context.fillRect(rect1.x-2,rect1.y-2,4,4);
var rect2={x:Math.random()*canvas.width,y:Math.random()*canvas.height};
context.fillStyle="#ff0000";
context.fillRect(rect2.x-2,rect2.y-2,4,4);
var dx=rect1.x-rect2.x,
dy=rect1.y-rect2.y,
dist=Math.sqrt(dx*dx+dy*dy);
log.value="distance:"+dist;
(8)勾股定律 中 两个随机出现的点的距离算法2
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
mouse=captureMouse(canvas),
log=document.getElementById('log');
var a=canvas.height/2;
rect={x:canvas.width/2,y:a};
(function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height);
var dx=rect.x-mouse.x,
dy=rect.y-mouse.y,
dist=Math.sqrt(dx*dx-dy*dy);
context.fillStyle="#000000";
context.fillRect(rect.x-2,rect.y-2,4,4);
context.beginPath();
context.moveTo(rect.x,rect.y);
context.lineTo(mouse.x,mouse.y);
context.closePath();
context.stroke();
log.value="distance:"+dist;
}());
八,方法介绍
//strokeStyle该属性用于指定线条的颜色.该值是一个颜色值(css风格的字符串),一个渐变对象或一个模式对象,线条默认颜色黑色(#000000)
//lineWidth:指定线条在路径上的宽度,默认为1,此时会在路径的两侧分别延半个像素,
//lineCap:线条的终点将如何绘制,它可以是平的,圆形活着,一段延伸线.该属性包含butt,round,square,默认是butt
//lineJoin:决定两条相连的线段如何结合,或者连接线的弯头部分如何绘制.round,bevel,miter.默认miter.
//miterLimit:当lineJoin属性设置问miter时,该属性可用于控制两条相交线外侧交点与内侧交点的距离,它必须是大于0的有限数,默认为10.
//context.save()
和context.restore()实现不同样式的转换,context.save()方法将canvas的当时状态存入栈中,包含各种样式,例
如:strokeStyle,fillStyle以及应用于canvas的变换效果.额外的样式变化会影响到后续的绘制指令.调用
context.restore()可以使得当时的canvas状态出栈而使用下一个状态,也就是上一个状态.//context.beginPath()即可表示想开始绘制一条新的路径,一条路劲只不过是构成一条线的一系列坐标位置,为了将它渲染到canvas上,需要调用contxt.stroke();
九:绘制宇宙飞船
function Ship(){
this.x=0;
this.y=0;
this.width=25;
this.height=20;
this.rotation=0;
this.showFlame=false;
}
Ship.prototype.draw=function(context){
context.save();
context.translate(this.x,this.y);
context.lineWidth=1;
context.strokeStyle="#ffffff";
context.beginPath();
context.moveTo(10,0);
context.lineTo(-10,0);
context.lineTo(-5,0);
context.lineTo(-10,-10);
context.lineTo(10,0);
context.stroke(); if(this.showFlame){
context.beginPath();
context.moveTo(-7.5,-5);
context.lineTo(-15,0);
context.lineTo(-7.5,0);
context.stroke();
}
context.restore();
};
十: 使用鼠标绘制路径
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
mouse=captureMouse(canvas);
function onMouseMove(){
context.lineTo(mouse.x,mouse.y);
context.stroke();
}
canvas.addEventListener('mousedown',function(){
context.beginPath();
context.moveTo(mouse.x,mouse.y);
canvas.addEventListener('mousemove',onMouseMove,false);
},false);
canvas.addEventListener('mouseup',function(){
canvas.removeEventListener('mousemove',onMouseMove,false)
},false);
十一,使用quadraticCurveTo绘制弯线,不会穿过控制点
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
mouse=captureMouse(canvas),
x0=100,y0=200,x2=300,y2=200; canvas.addEventListener('mousemove',function(){
context.clearRect(0,0,canvas.width,canvas.height);
var x1=mouse.x,y1=mouse.y;
context.beginPath();
context.moveTo(x0,y0);
context.quadraticCurveTo(x1,y1,x2,y2);
context.stroke();
},false);
十二:使用quadraticCurveTo绘制弯线,穿过控制点
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
mouse=captureMouse(canvas),
x0=100,y0=200,x2=300,y2=200; canvas.addEventListener('mousemove',function(){
context.clearRect(0,0,canvas.width,canvas.height);
var x1=mouse.x*2-(x0+y2)/2,y1=mouse.y*2-(x0+y2)/2;
context.beginPath();
context.moveTo(x0,y0);
context.quadraticCurveTo(x1,y1,x2,y2);
context.stroke();
},false);
十三:色值渐变色:线性渐变
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
pt1={x:0,y:0},pt2={x:100,y:100},
gradient=context.createLinearGradient(pt1.x,pt2.y,pt2.x,pt2.y);
gradient.addColorStop(0,"#ffffff");//为渐变色添加颜色
gradient.addColorStop(0.5,"#0000ff")
gradient.addColorStop(1,"#ff0000");
context.fillStyle=gradient;
context.fillRect(0,0,100,100);//绘制并填充一个矩
十四:色值渐变色:线性渐变
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
c1={x:150,y:150,radius:0},c2={x:150,y:150,radius:50},
gradient=context.createRadialGradient(c1.x,c1.y,c1.radius,c2.x,c2.y,c2.radius);
gradient.addColorStop(0,"#ffffff");//为渐变色添加颜色
//gradient.addColorStop(0.5,"#0000ff")
gradient.addColorStop(1,"#ff0000");
context.fillStyle=gradient;
context.fillRect(0,0,100,100);//绘制并填充一个矩形
十五: 绘制图片
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
image=new Image(); image.src='1.jpg';
image.onload=function(){
//context.drawImage(image,0,0);//图片左上角位置0,0
//context.drawImage(image,0,0,400,400);//图片左上角位置0,0,图片尺寸400,400
context.drawImage(image,50,50,450,450,50,50,300,300);//(image,sx,sy,sw,sh,dx,dy,dw,dh),将图片裁剪到矩形内(sx,xy,sw,sh)中,并缩放至(dh,dw),在绘制到(dx,dy)坐标
};
十六:绘制canvas中的图片
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
image=document.getElementById("picture");//<canvas id="canvas" width="400px" height="400px" style="border:1px solid red; position:absolute; left:200px; top:50px;"><img src="1.jpg" id="picture" /></canvas>
context.drawImage(image,0,0);
十七:速度向量,双轴上的圆运动
var canvas=document.getElementById("canvas"),
context=canvas.getContext("2d"),
ball=new Ball(),
vx=1,vy=1;
ball.x=50,ball.y=100; (function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height);
ball.x+=vx;
ball.y+=vy;
ball.draw(context);
}());
十八:角速度
var canvas=document.getElementById("canvas"),
context=canvas.getContext("2d"),
ball=new Ball(),
angle=45,speed=1;
ball.x=50,ball.y=100; (function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height); var radians=angle*Math.PI/180,
vx=Math.cos(radians)*speed,vy=Math.sin(radians)*speed;
ball.x+=vx;ball.y+=vy;
ball.draw(context);
}())
十九:鼠标追随者
var canvas=document.getElementById("canvas"),
context=canvas.getContext("2d"),
mouse=captureMouse(canvas),
arrow=new Arrow(),
speed=3;
(function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height);
var dx=mouse.x-arrow.x,
dy=mouse.y-arrow.y,
angle=Math.atan2(dy,dx),
vx=Math.cos(angle)*speed,
vy=Math.sin(angle)*speed; arrow.rotation=angle;arrow.x+=vx;arrow.y+=vy;
arrow.draw(context);
}());
二十:速度向量扩展
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
mouse=captureMouse(canvas),
arrow=new Arrow(),
vr=2;
arrow.x=canvas.width/2;
arrow.y=canvas.height/2; (function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height/2);
arrow.rotation+=vr*Math.PI/180;
arrow.draw(context);
}());
二十一: 键盘的左右键控制圆的运动
var canvas=document.getElementById("canvas"),
context=canvas.getContext("2d"),
ball=new Ball(),
vx=0,ax=0,ay=0,vy=0; ball.x=canvas.width/2;
ball.y=canvas.height/2; window.addEventListener('keydown',function(event){
if(event.keyCode==37){//左
ax=-0.1;
}
else if(event.keyCode==39){//右
ax=0.1;
}
else if(event.keyCode==38){ay=-0.1;}//上
else if(event.keyCode==40){ay=0.1;}//下
},false); window.addEventListener('keyup',function(){
ax=0;
ay=0;
},false); (function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height); vx+=ax;vy+=ay;
ball.x+=vx;
ball.y+=vy;
ball.draw(context);
}());
二十二:单轴加速度
var canvas=document.getElementById('canvas'),
context=canvas.getContext('2d'),
ball=new Ball(),
vx=0,ax=0.1;
ball.x=50;ball.y=100; (function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height);
vx+=ax;
ball.x+=vx;
ball.draw(context);
}());
双轴加速度
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
ball=new Ball(),
vx=0,vy=0,ax=0,ay=0;
ball.x=canvas.width/2;
ball.y=canvas.height/2;
window.addEventListener('keydown',function(){
switch(event.keyCode){
case 37://left
ax=-0.1;
break;
case 39://right
ax=0.1;
break;
case 38:
ay=-0.1;
break;
case 40:
ay=0.1;
break;
}
},false);
window.addEventListener('keyup',function(){
ax=0; ay=0;
},false);
(function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height);
vx+=ax;
vy+=ay;
ball.x+=vx;
ball.y+=vy;
ball.draw(context);
}()); 重力加速度
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
ball=new Ball(),
vx=0,vy=0,ax=0,ay=0;
ball.x=canvas.width/2;
ball.y=canvas.height/2;
var gravity=0.02; window.addEventListener('keydown',function(){
switch(event.keyCode){
case 37://left
ax=-0.1;
break;
case 39://right
ax=0.1;
break;
case 38:
ay=-0.1;
break;
case 40:
ay=0.1;
break;
}
},false);
window.addEventListener('keyup',function(){
ax=0; ay=0;
},false);
(function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height); vx+=ax;
vy+=ay;
vy+=gravity;
ball.x+=vx;
ball.y+=vy; ball.draw(context);
}()); 角加速度
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
mouse=captureMouse(canvas),
arrow=new Arrow(),
vx=0,vy=0,force=0.05;
(function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height);
var dx=mouse.x-arrow.x,
dy=mouse.x-arrow.y,
angle=Math.atan2(dy,dx),
ax=Math.cos(angle)*force,
ay=Math.sin(angle)*force;
arrow.roation=angle;
vx+=ax;vy+=ay;
arrow.x+=vx;arrow.y+=vy;
arrow.draw(context);
}()); 制作飞船
var canvas=document.getElementById("canvas"),
context=canvas.getContext("2d");
var ship=new Ship(),
vr=0,vx=0,vy=0,thrust=0; ship.x=canvas.width/2;
ship.y=canvas.height/2;
window.addEventListener('keydown',function(event){
switch(event.keyCode){
case 37://left
vr=-3;
break; case 39://right
vr=3;
break; case 38://up
thrust=0.05;
ship.showFlame=true;
break;
}
},false); window.addEventListener('keyup',function(){
vr=0;
thrust=0;
ship.showFlame=false;
},false); (function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height);
ship.rotation+=vr*Math.PI/180;
var angle=ship.rotation,
ax=Math.cos(angle)*thrust,
ay=Math.sin(angle)*thrust;
vx+=ax;vy+=ay;
ship.x+=vx;ship.y+=vy;
ship.draw(context);
}()); 随机出现移动的小圆,移动超出边界的话,将他移除掉
var canvas=document.getElementById("canvas"),
context=canvas.getContext('2d'),
log=document.getElementById('log'),
balls=[],
numBalls=10; for(var ball,i=0;i<numBalls;i++){
ball=new Ball(20);
ball.id="ball"+i;
ball.x=Math.random()*canvas.width;
ball.y=Math.random()*canvas.height;
ball.vx=Math.random()*2-1;
ball.vy=Math.random()*2-1;
balls.push(ball);
} function draw(ball,pos){
ball.x+=ball.vx;
ball.y+=ball.vy;
if(ball.x-ball.radius>canvas.width||
ball.x+ball.radius<0||
ball.y-ball.radius>canvas.height||
ball.y+ball.radius<0){
ball.splice(pos,1);
if(balls.length>0){
log.value="Removed"+ball.id;
}
else{
log.value="All gone!";
}
}
ball.draw(context);
}
(function drawFrame(){
window.requestAnimationFrame(drawFrame,canvas);
context.clearRect(0,0,canvas.width,canvas.height);
var i=balls.length;
while(i--){
draw(balls[i],i);
} }()); })
HTML5的动画学习历程的更多相关文章
- html5和css3学习历程
1.video,audio视频和音频的应用 <!doctype html><html> <head></head> <body> < ...
- HTML5 Canvas画图与动画学习59例
HTML5 Canvas画图与动画学习59例 学习HTML5 动画,画图的好资料. HTML5 Canvas画图与动画学习59例
- 7 个顶级的 HTML5 Canvas 动画赏析
HTML5确实是一项改革浏览器乃至整个软件行业的新技术,它可以帮助我们Web开发者很方便地在网页上实现动画特效,而无需臃肿的Flash作为支撑.本文分享7个顶级的HTML5 Canvas 动画,都有非 ...
- 【转】15个无比华丽的HTML5/CSS3动画应用
原文转自:http://www.html5cn.org/article-7089-1.html 前几天,HTML5标准已经尘埃落定,未来的Web将会是由HTML5主导,当然作为开发者对这一喜讯更为动心 ...
- HTMl5/CSS3/Javascript 学习推荐资源
HTMl5/CSS3/Javascript 学习推荐资源 前端的定义应该是数据内容的展示,在国内大家都觉得前端只是HTML+CSS+Javascript,但是实际上与展示有关的都是前端,所以Ruby/ ...
- HTML5课程大纲/学习路线
HTML5课程大纲/学习路线 这是什么? 这个一个HTML技术路线的课程大纲/学习大纲. 你能用它做什么? 如果你是找工作的人, 利用本大纲, 你可以学习HTML5语言, 做一个HTML前端工程师, ...
- 超给力的HTML5 3D动画欣赏及源码下载
HTML5有着非常巨大的魅力,尤其是CSS3和Cavnas,可以帮助页面渲染得非常炫酷.值得一提的是,利用HTML5的3D特性可以帮助你更加方便地在网页上实现3D动画特效.本文分享的这些HTML5 3 ...
- 16个富有创意的HTML5 Canvas动画特效集合
HTML5技术正在不断的发展和更新,越来越多的开发者也正在加入HTML5阵营,甚至在移动开发上HTML5的地位也是越来越重要了.HTML5中的大部分动画都是通过Canvas实现,因为Canvas就像一 ...
- 7款让人惊叹的HTML5粒子动画特效
HTML5的很大一个优势就是可以更加便捷高效地制作网页粒子动画特效,特别是Canvas特性,可以实现在网页上绘制任何图形和动画.本文要分享7款让人惊叹的HTML5粒子动画特效,这些粒子特效都提供源代码 ...
随机推荐
- 让Js顺序执行且回调之
<script src="aaa"></script> <script type="aaasdf" id="asdf&q ...
- c编码-2
1.重设socket缓冲区 系统提供的socket缓冲区大小为8K,你可以将之设置为64K,尤其在传输实时视频时. [root@8A_3 src]# gcc socka.c[root@8A_3 src ...
- linux包之findutils之find和xargs命令
解释 [root@localhost ~]# rpm -qa|grep findfindutils-4.4.2-6.el6.x86_64 find 路径 测试 动作 三个步骤的处理过程查找一个或多个目 ...
- Dubbo与Zookeeper、SpringMVC整合和使用(负载均衡、容错)转
互联网的发展,网站应用的规模不断扩大,常规的垂直应用架构已无法应对,分布式服务架构以及流动计算架构势在必行,Dubbo是一个分布式服务框架,在这种情况下诞生的.现在核心业务抽取出来,作为独立的服务,使 ...
- Maven最佳实践:版本管理
什么是版本管理 首先,这里说的版本管理(version management)不是指版本控制(version control),但是本文假设你拥有基本的版本控制的知识,了解subversion的基本用 ...
- Oracle无法启动,ORA-01034、ORA-01078
因为调整32位系统的SGA区大小时不慎,超出可用内存,造成Oracle实例无法启动,报出ORA-01034.ORA-01078等错误.如下图 sqlplus /nolog SQL> conn / ...
- linux中常用目录的作用
/bin 存放使用者最长用的命令,如:cp.ls.cat,等等. /boot 启动linux时使用的一些核心文件. /dev 是device(设备)的缩写,这个目录下是所有linux的外围设备. D ...
- 如何增加swap 大小
第一步:(这里增加2G) [root@kmdbrac1 /]# mkdir swap #创建一个文件夹,存放交换空间文件 [root@kmdbrac1 /]# cd swap # ...
- Kafka 安装和测试
转载自:http://czj4451.iteye.com/blog/2041096 1. 简介 kafka (官网地址:http://kafka.apache.org)是一款分布式消息发布和订阅的系统 ...
- elasticsearch 跨网段组集群
elasticsearch 是非常流行的全文搜索引擎,但网上的教程多是初次使用,并没有一些高级用法demo.这次遇到需要跨网段组网问题,自己摸索了文档很久,发现确实可行,于是着手做了个实验,最终实验成 ...