大魚的眼睛不能和鼠標(biāo)重合,總是有一段固定的距離
function onMouseMove(e)
{
?? ?if(e.offSetX || e.layerX)
?? ?{
?? ??? ?mx = e.offSetX == undefined ? e.layerX : e.offSetX;
?? ??? ?my = e.offSetY == undefined ? e.layerY : e.offSetY;
?? ??? ?
?? ?}
}
---------------------------------------------------------------------------
this.x = lerpDistance(mx, this.x, 0.98);
this.y = lerpDistance(my, this.y, 0.98);
2016-08-12
把大魚的跟隨強(qiáng)度改成0.01
這個(gè)值越小,跟鼠標(biāo)跟得越緊