![]() |
|
||||||||||
|
|||||
|
если речь идет о вращении объекта вокруг произвольной точки, то
rotateAroundInternalPoint() и rotateAroundExternalPoint() класса MatrixTransformer http://help.adobe.com/ru_RU/AS3LCR/F...ansformer.html |
|
|||||
|
Регистрация: Mar 2008
Сообщений: 215
|
Цитата:
|
|
|||||
|
.
|
Точно, круто!
Вот реализация /** * Rotates a matrix about a point defined inside the matrix's transformation space. * This can be used to rotate a movie clip around a transformation point inside itself. * * @param m A Matrix instance. * * @param x The x coordinate of the point. * * @param y The y coordinate of the point. * * @param angleDegrees The angle of rotation in degrees. * @playerversion Flash 9.0.28.0 * @langversion 3.0 * @keyword Matrix, Copy Motion as ActionScript * @see flash.geom.Matrix */ public static function rotateAroundInternalPoint(m:Matrix, x:Number, y:Number, angleDegrees:Number):void { var point:Point = new Point(x, y); point = m.transformPoint(point); m.tx -= point.x; m.ty -= point.y; m.rotate(angleDegrees*(Math.PI/180)); m.tx += point.x; m.ty += point.y; } /** * Rotates a matrix about a point defined outside the matrix's transformation space. * This can be used to rotate a movie clip around a transformation point in its parent. * * @param m A Matrix instance. * * @param x The x coordinate of the point. * * @param y The y coordinate of the point. * * @param angleDegrees The angle of rotation in degrees. * @playerversion Flash 9.0.28.0 * @langversion 3.0 * @keyword Matrix, Copy Motion as ActionScript * @see flash.geom.Matrix */ public static function rotateAroundExternalPoint(m:Matrix, x:Number, y:Number, angleDegrees:Number):void { m.tx -= x; m.ty -= y; m.rotate(angleDegrees*(Math.PI/180)); m.tx += x; m.ty += y; } |
|
|||||
|
Регистрация: Mar 2008
Сообщений: 215
|
Напрасно иронизируете - приведенный вами код, в случае существования нативного класса, не приходится писать и включать в свои проекты. Что есть экономия времени(единоразовая, но все же) и размера бинарника.
Я бы так же радовался, если бы, к примеру, в Graphics была нативная реализация кривых Безье третьего порядка, или в lineStyle можно было бы задавать stroke для рисования штрих-пунктирных линий, или если бы было реализована куча других полезных вещей, существующих в других языках, для которых в as приходится С другой стороны, тогда бы вырос размер плеера. Хотя кого это интересует при теперешних скоростях интернета? Тем более, что размер дистрибутива плеера и так вырос в пару раз с 9 до 10.1 версии. |
|
|||||
|
Регистрация: Apr 2010
Адрес: Earth
Сообщений: 1,897
|
Цитата:
Цитата:
Последний раз редактировалось i.o.; 09.09.2010 в 09:33. |
|
|||||
|
Регистрация: Mar 2008
Сообщений: 215
|
Цитата:
Вроде lineStyle обычно вызывается перед этими методами(для задания ширины линии и т.п.)? |
|
|||||
|
Регистрация: Apr 2010
Адрес: Earth
Сообщений: 1,897
|
Цитата:
Цитата:
|
![]() |
![]() |
Часовой пояс GMT +4, время: 06:49. |
|
|
« Предыдущая тема | Следующая тема » |
|
|