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 8228515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:28:59+00:00 2026-06-07T16:28:59+00:00

I have a problem with CAAnimationGroup . I have a view called animeView and

  • 0

I have a problem with CAAnimationGroup. I have a view called animeView and I want to apply a 3D rotation around Y axis and a scaling transform at the same time. The rotation and scaling animations work perfectly fine separately! But when I add them to a CAAnimationGroup Non of the animations occur!

What is the problem?

CAKeyframeAnimation *rotation = [CAKeyframeAnimation animation];
CATransform3D rotationTransform = CATransform3DMakeRotation(M_PI, 0.0f, 1.0f, 0.0f);
rotationTransform.m34 = 1.0 / -500;

rotation.values = [NSArray arrayWithObjects:
                   [NSValue valueWithCATransform3D:CATransform3DMakeRotation(0.0f, 0.0f, 1.0f, 0.0f)],
                   [NSValue valueWithCATransform3D:rotationTransform],
                   [NSValue valueWithCATransform3D:CATransform3DMakeRotation(2.0*M_PI, 0.0f, 1.0f, 0.0f)] ,nil];

CAKeyframeAnimation *trans = [CAKeyframeAnimation animation];

trans.values = [NSArray arrayWithObjects:[NSValue valueWithCATransform3D:CATransform3DIdentity],[NSValue valueWithCATransform3D:CATransform3DMakeScale(0.5, 0.5, 0.5)],[NSValue valueWithCATransform3D:CATransform3DIdentity], nil];

CAAnimationGroup *group = [CAAnimationGroup animation];

group.delegate = self;
[group setAnimations: [NSArray arrayWithObjects:rotation, trans, nil]];
group.duration = 2;
group.repeatCount = 3;

[self.animView.layer addAnimation:group forKey:nil];
  • 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-07T16:29:01+00:00Added an answer on June 7, 2026 at 4:29 pm

    There are two things that is strange with the code you’ve provided.

    1. The animations doesn’t know what property they should be changing (no key path is set)
    2. Both animations are changing the transform (what value should really be used?)

    The way I see it is that you have two transform key-frame animations with the same number of values (three). Therefore you should calculate the total transformation matrix (both scale and rotate in one matrix) and only add that animation to your view.

    It would look something like this (I’ve added lots of comments to explain what sis happening):

    // Your first rotation is 0 degrees and no scaling
    CATransform3D beginTransform = CATransform3DIdentity;
    
    // Your middle rotation is the exact one that you provided ...
    CATransform3D middleTransform = CATransform3DMakeRotation(M_PI, 0.0f, 1.0f, 0.0f);
    // ... but the rotation matrix is then scaled as well ...
    middleTransform = CATransform3DScale(middleTransform, 0.5, 0.5, 0.5);
    // ... and the perspective is set
    middleTransform.m34 = 1.0 / -500;
    
    // Your end value is rotated but not scaled
    CATransform3D endTransform = CATransform3DMakeRotation(2.0*M_PI, 0.0f, 1.0f, 0.0f);
    
    // Create a new animation that should animate the "transform" property (thus the key path "transform")
    CAKeyframeAnimation *rotateAndScale = [CAKeyframeAnimation animationWithKeyPath:@"transform"];
    // same configurations as your group had
    [rotateAndScale setDuration:2.0];
    [rotateAndScale setRepeatDuration:3.0];
    [rotateAndScale setDelegate:self];
    // Set the values of the transform animation (yes, both scaling and rotation in one animation)
    [rotateAndScale setValues:[NSArray arrayWithObjects:
                               [NSValue valueWithCATransform3D:beginTransform], 
                               [NSValue valueWithCATransform3D:middleTransform], 
                               [NSValue valueWithCATransform3D:endTransform], nil]];
    
    // Add the animation to the layer, no need for a group here...
    [animView.layer addAnimation:rotateAndScale forKey:nil];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem SIMILAR to preventing form data reposting, but not quite the same
I have problem with my timer. In my game view in viewDidLoad I have:
I have problem with php's preg_match.I want to make something like this : When
i have problem to pass data from view to controller , i have view
I have problem in C#. I have a list box and a class called
I have problem in determining time complexities of algorithms. for(int i=0;i <n i++){} O(n)
I have problem while defining keys in resource file for globalization. i want to
I have problem with addthis widget when apply ember 0.9.8.1 on my site. Could
I have problem with this code..I want to extract data from flat file and
I have problem with return statment >.< I want to store all magazine names

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.