缓动公式:
sprite.x += (targetX - sprite.x) * easing;//easing为缓动系数变量
sprite.y += (targetY - sprite.y) * easing;
弹性公式:
vx += (targetX - sprite.x) * spring;//spring为弹性系数
vy += (targetY - sprite.y) * spring;
sprite.x += (vx *= friction);//friction为摩擦力
sprite.y += (vy *= friction); 偏移弹性公式:
var dx:Number = sprite.x - fixedX;
var dy:Number = sprite.y - fixedY;
var angle:Number = Math.atan2(dy, dx);
var targetX:Number = fixedX + Math.cos(angle) * springLength;
var targetY:Number = fixedX + Math.sin(angle) * springLength;
向鼠标旋转(或向某点旋转)
dx = mouseX - sprite.x; dy = mouseY - sprite.y;
sprite.rotation = Math.atan2(dy, dx) * 180 / Math.PI;
波形运动: