简体   繁体   中英

Adobe Flash/Animate - transformation point equivalent in Actionscript 3

When you're using the Flash/Animate IDE and you select something on the stage with the Free Transform Tool, then move the transformation point (the white circle), what is it actually doing in frame script? DisplayObject s only have x and y properties, there's no transformX or transformY.

I have a MovieClip place on the stage through the Flash IDE with various transformations applied to it, and I would like to be able to replicate those in Actionscript.

When you're creating a display object in IDE, moving transformation point makes IDE move everything inside that object in reverse direction coordinates wise. It's like if you're moving a zero point of a local coordinates system, leaving everything else intact, the contents will then have their coordinates altered.

In order to simulate this behavior, you can nest your display object being created into a container sprite, then when your user drags transformation center, you move the wrapper sprite to the new coordinates and alter its nested object's ( the one with all the contents) coordinates by negative delta between old and new positions of virtual zero.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM