首页 > 其他 > 详细

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

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

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++); 开根号

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!