码迷,mamicode.com
首页 > 其他好文 > 详细

鸟速度不匀速的方法Math.sqrt(this.i++); 开根号

时间:2018-01-20 12:43:43      阅读:140      评论:0      收藏:0      [点我收藏+]

标签:cti   sqrt   func   prototype   parse   body   pos   nbsp   int   

function Bird(imgArr, x, y){
this.imgArr = imgArr;
this.x = x;
this.y = y;
this.idx = parseInt(Math.random() * this.imgArr.length);
this.img = this.imgArr[this.idx];
// 定义一个变量用于记录鸟的位置
this.positionY = 0;
// 定义一个变量用于改变鸟的位置
this.i = 0;
}

 

Bird.prototype.fall = function(){
  this.positionY += Math.sqrt(this.i++);
};

鸟速度不匀速的方法Math.sqrt(this.i++); 开根号

标签:cti   sqrt   func   prototype   parse   body   pos   nbsp   int   

原文地址:https://www.cnblogs.com/oklfx/p/8320195.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!