Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8073609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:23:05+00:00 2026-06-05T14:23:05+00:00

I have a view with it’s underlying layer , and I add a CATransformLayer

  • 0

I have a view with it’s underlying layer, and I add a CATransformLayer to the view’s layer:

[view.layer addSublayer:transformLayer];

My added layer contains all sorts of sublayers representing individual sides of several 3 dimensional blocks. I would like to apply an animation to a layer to rotate the blocks.

CATransform3D rotation = CATransform3DMakeRotation(deg * M_PI / 180, x, y, z);
[CATransaction begin];

    [(CATransformLayer *)[pView.layer.sublayers objectAtIndex:0] setSublayerTransform:rotation];
        or (both seem to produce the same result)
    [(CATransformLayer *)[pView.layer.sublayers objectAtIndex:0] setTransform:rotation];

[CATransaction commit];

The problem is the layer is rotating roughly around the front corner instead of the center of the cubes (see below for example).

                    / \                  / \        
   / \            / \ / \              / \ / \      
 / \ / \         |\ / \ /|            |\ / \ /|     
|\ / \ /|        | |\ /| |            | |\ /| |     
| |\ /| |         \| | |/ \    OR    / \| | |/      
|\| | |/|  ==>      \|/ \ / \      / \ / \|/        
|1|\|/|B|            |\ / \ /|    |\ /   /|         
 \|2|A|/             |A|\ /| |    | |\ /|2|         
   \|/                \|B| |/      \| |1|/          
                        \|/          \|/            

The A/B labels should move to the 1/2 positions, or 1/2 should move to A/B, depending on the direction of rotation. Instead it changes from the first figure, rotates roughly around the front corner, resulting in something close to the other figures. The upper unlabeled blocks are in a different view and static so not part of the rotation. The lower labeled blocks are in the view/layer I am trying to animate.

How do I change the center of rotation to achieve my desired result?

I have messed with anchorPoint, zPosition, anchorPointZ for various layers with no success. Have tried setSublayerTransform, setTransform as well.

Should I be messing with settings for the block side sublayers, the transform layer, the view layer, or the view itself to achieve what I am after?

Any guidance or direction would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:23:07+00:00Added an answer on June 5, 2026 at 2:23 pm

    UPDATE:

    I have finally come to the realization and accepted the fact that I can not do this using Core Animation.

    I have gone down the road of using OpenGL to solve this problem.


    This problem has slowly evolved as I make improvements bit by bit, but the end result involves making the parent layer a CATransformLayer, which retains the 3D perspective, and rotating that.

    As far as the center of rotation, I use CATransform3DMakeTranslation to change the position of the layer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have view controller which contains a button which show the image library ,if
Imagine situation: I have view directory with tons of different views. all views have
I have view which contains a scrollView. When the view shows up the image
I have view that contains a table with the following structure: <table id=mappings> <thead>
I have view that extends ViewPart . In this view, I want to add
I have a view controller that contains a table view, the items in the
I have a view controller which contains a table view, and which is wrapped
In a WPF MVVM application, you have view models that contain all the logic
I have view on which I defined a custom tagName. I need to be
i have view like 'home/details/5', it can be access by anonymous user. but there

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.