前言:
现在不努力,将来拿什么向曾经抛弃你的人证明它有多瞎
--------------------------------正文---------------------------------
vue-resource
get
getData(){
this.$http.get('http://localhost:8081/getData').then(function(res){
console.log(res.body.a+res.body.b)
},function(){
alert('失败');
});
}
jsonp
getData(){
this.$http.jsonp('https://sp0.baidu.com/5a1Fazu8AA54nxGko9WTAnF6hhy/su',{
params:{
wd:'a'
},
jsonp:'cb'
}).then(function(res){
this.getList=res.body.s;
},function(){
alert('失败');
});
}
canvas
获取canvas对象
获取绘图上下文 var gd = oC.getContext('2d');
重新开始路径 gd.beginPath();
起始点 gd.moveTo(x,y);
目标点 gd.lineTo(x,y);
设置描边颜色 gd.strokeStyle = 'color';
设置线宽 gd.lineWidth = width;
描边 gd.stroke();
填充颜色 gd.fillStyle = 'color';
填充 gd.fill();
闭合路径 gd.closePath();
清屏 gd.clearRect(x,y,w,h);
---------------------------------------------------------------------------------------
现有图形 rect 矩形
a)
gd.rect(x,y,w,h);
gd.stroke()/fill();
b)
gd.strokeRect(x,y,w,h);
或
gd.fillRect(x,y,w,h);
帧频
低帧频
30 1000/30 33
高帧频
16 1000/16 62
关于角度和弧度
Math.sin(α);
Math.cos(α);
360° = 2π
180° = 1π
π Math.PI
角度 ==> 弧度
n*Math.PI/180
弧度 ==> 角度
n*180/Math.PI