I have 3 squares (50 px x 50 px) in a Sprite, one next to each other. Pivot of each is at 0, 0. 1st square X, Y: 0, 0 2nd square X, Y: 50, 0 3rd square X, Y: 100, 0 I would like to rotateX each square around its center-line. I cannot seem to figure out how to set the vanishing point so that all the squares rotate around their individual point and not all of them around the same point. Any help greatly appreciated!
RotateX a square around its center
1.7k Views Asked by Fygo At
2
There are 2 best solutions below
1
Mark Knol
On
Basically, you need to move the box while it is rotating to get that effect. Since you also know the width/height of the box and the pivot points positions the calculations aren't that hard.
However, why calculate it yourself? With TweenLite, You could use the TransformAroundCenterPlugin, which handles the transformation for you. I would recommend to use it. If you don't want to tween it, then set the tween-duration (second parameter) to 0.
// Activate plugin (should be called once)
TweenPlugin.activate([TransformAroundPointPlugin]);
// Transform your boxes around it's center, does not use the pivot point.
TweenLite.to(this.mcBox1, 1, new TweenLiteVars().transformAroundCenter({rotationX: 50}));
TweenLite.to(this.mcBox2, 1, new TweenLiteVars().transformAroundCenter({rotationX: 190}));
TweenLite.to(this.mcBox3, 0, new TweenLiteVars().transformAroundCenter({rotationX: 5}));
Related Questions in ACTIONSCRIPT-3
- [Actionscript]How to display the information inside an array of objects
- How to set a colour variable in JS
- When using INSERT OR REPLACE INTO in SQL is there any way to tell if a record was inserted as new or replaced in SQL for AS3?
- How to inject a bean in a view with Crux
- AS3 - Unable to resize Image width and height
- How do I move Pac-Man smoothly in AS3?
- Export Release Build is not working in Adobe Flash Builder, It does nothing on Finish button
- 1009 Error for a Character Skin Symbol in AS3
- Issue setting domain memory
- Implicit coercion of a value with static type Object to a possibly unrelated type Number
- Defer implementation of interface functions to child class
- Simple top 3 scores from an array to textfield
- Need ActionScript 3 coding for input boxes that will determine amount of color fill in a movieclip
- AS3 Caling MC on Parent Timeline from Child
- 2 error problems for simple music players
Related Questions in FLASH
- Failing write/read on RH850 with NOR flash
- Unique ID to transfer guest account data from Adobe AIR to Unity
- flashplayer_32_sa: SecurityError: Error #2028: Local-with-filesystem SWF file
- what is the simplest way and what applications to use in making an exe file that runs .swf file assetss
- Does a physical filesystem works only for a specific type of storage media?
- when I try to enable flash encryption in esp32, the bootloader size is large . But I'm unable to find bootloader field in partition table
- Manage FIFO implemented in a non-volatile flash NOR memory
- create a quiz with actionscript 3
- How to connect two x16 nor flash to nor flash controller?
- Looping in Adobe Flash Professional CS6
- AOSP flahed to android emulator
- How do I compile Flash app files with mxml and as extensions?
- Winbond W25Q01 (1G-BIT) Flash erases 256-bytes not 4K and fails write-read-verify after address 0x07000000
- On Pixel 7a Android AOSP
- Defer implementation of interface functions to child class
Related Questions in ACTIONSCRIPT
- [Actionscript]How to display the information inside an array of objects
- eval vs Function() return semantics
- create a quiz with actionscript 3
- How do I move Pac-Man smoothly in AS3?
- Issue setting domain memory
- proplem in in using load with enterframe event in flash & actionscript3
- Defer implementation of interface functions to child class
- How do I fix this Else-If error for my platformer?
- Layer Parenting, Make Child Layers Move Along With Parent Layer That's Being Moved by ActionScript 3.0?
- Action Script Trace
- How to return data type "Date" using AMFPHP
- For loop only sets last iteration
- I cant do an image gallery movie clip , my buttons doesnt work
- Scanning nextjs application by Sonarqube fails on github actions
- Assign custom field price as product price to specific user role in WooCommerce more than one
Related Questions in ROTATION
- Issues with a rotation gizmo and sign flips when converting back to euler angles
- Flutter rotate the screen
- How can glPushMatrix affect the rotation of an object around a rotating object?
- Camera rotation to direction vector
- Quaterion capitalization difference
- How can I make a sphere follow an eight-like path in Python using OpenGL?
- How to find the rotation of a quaternion along each of the 3 axes separately?
- calculate the relative rotation based on the pose matrices in visual SLAM
- Curved Carrousel
- My app in Android Studio using Kotlin restarts upon rotation (using seperate landscape and portait XML files)
- How to calculate angular acceleration in quaternion form?
- Expanding quad to be oriented along control points
- Burger menu is preventing scrolling fucntionality?
- Quaternion to exponential map, can code be improved?
- Rolling effect when looking at corners with custom rotation function
Related Questions in VANISHING-POINT
- Image alignment (camera pose rectification) by using vanishing points and gradient descent
- Finding the Angle between Vanishing point and Lines in Python
- Three-points projection JS
- Extract vanishing point from lines with Open CV
- Applying gabor filter independant of frontier colors
- What is maximum of vanishing points for perspective projection?
- How to find vanishing points from vanishing lines?
- Moving the perspective vanishing point in Processing
- Vanishing point detection from vanishing line using Hough transform
- gluPerspective has vanishing point in corner. Opengl
- iOS - Using the same vanishing point for multiple elements when using CATransform3d
- How to modify the perspective division in OpenGL?
- Detect vanishing point in an image
- Vanishing points in rubiks cube
- OpenCV time to contact with optical flow
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
You can make the rotation of child movieclips by rotating and translating them to newer position. Required the pivot of the child movieclip coincides with it's registration point
in the following code, the holder is your sprite and content are the squares. ( Required that squares are having the pivot, coinciding with the registration point)
PS: Holder must have a width and height bigger than the content's. It's assumed that holder here is some kind of big container ( say stage).