|
|
|||||
Регистрация: Sep 2009
Сообщений: 95
|
реалистичное передвижение мувика
помогите!!
хочу написать скрипт который позволит реалистично передвигать мувик по сцене ,так как будто ты двигаешь лист бумаги по столу за край , то есть что бы мувик крутился вокруг точки захвата и относительно движению курсора. буду надеется что я объяснился понятно
__________________
=) |
|
|||||
Регистрация: Feb 2008
Сообщений: 560
|
Бюджет?
В первом приближении смотрите вложение. Код: mc.onPress = function () { var xm0 = this._parent._xmouse; var ym0 = this._parent._ymouse; var xm = this._xmouse; var ym = this._ymouse; this._x = xm0; this._y = ym0; this.img._x += -xm; this.img._y += -ym; this.oldax = this._parent._xmouse; this.olday = this._parent._ymouse; this.basea = 180/Math.PI * Math.atan2(-this.img._y - this.img._height/2, -this.img._x - this.img._width/2); this.cang = this._rotation; this.onMouseMove = function () { var ang = 180/Math.PI * Math.atan2((this._parent._ymouse - this.olday), (this._parent._xmouse - this.oldax)) - this.basea; if (Math.abs(ang + 360 - this._rotation) < Math.abs(ang - this._rotation)) { ang += 360; } if (Math.abs(ang - 360 - this._rotation) < Math.abs(ang - this._rotation)) { ang -= 360; } this.oldax = this._parent._xmouse; this.olday = this._parent._ymouse; var cang = this._rotation; var dir = (ang - cang)/20; var angle = cang + dir; this._rotation = angle; this._x = this._parent._xmouse; this._y = this._parent._ymouse; } } mc.onRelease = mc.onReleaseOutside = function () { delete mc.onMouseMove; } |
Часовой пояс GMT +4, время: 15:26. |
|
« Предыдущая тема | Следующая тема » |
Теги |
движение , курсор , мувик |
|
|