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

  • Home
  • SEARCH
  • 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 588419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:18:58+00:00 2026-05-13T15:18:58+00:00

I try to do this: There is an view which has been rotated already

  • 0

I try to do this: There is an view which has been rotated already to some value, lets say 15 degrees.

Imagine a view rotated by 15 degrees.

Next, I only know, that I want this view to rotate from it’s current rotation to 40 degrees.

Imagine how that view now rotates from 15 to 40 degrees.

For practice, I want to do that with CAKeyFrameAnimation. But the thing is, all I can do there is to hard-specify from where to where. There’s no convenient “pick up current state” thing like UIView animations have, right? How would I go about it?

Also, I want to specify always 3 keyframes for that rotation, no matter how much the needed amount of rotation is.

Imagine how that view rotates from 15 to 40 degrees, using 3 keyframes to do so

But another big problem: It might happen, that another animation has to kick in with a different target. lets say a view is currently rotation from 20 to 100 degrees, and just somewhere inbetween the animation a new animation is kicked and wants that view to go to 15 degrees. With UIView animations that’s simple. How to do that with CAKeyFrameAnimation?

Basically I want it to behave like UIView animations which pick up current state 😉

CALayer* theLayer = rotatedView.layer;

CAKeyframeAnimation* animation;
animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];

animation.duration = 2;
animation.repeatCount = 1;
animation.removedOnCompletion = NO;
animation.fillMode = kCAFillModeForwards;

animation.values = [NSArray arrayWithObjects:
                    [NSNumber numberWithFloat:(10.0 / 180.0) * M_PI],
                    [NSNumber numberWithFloat:(20.0 / 180.0) * M_PI],
                    [NSNumber numberWithFloat:(30.0 / 180.0) * M_PI], nil];

[theLayer addAnimation:animation forKey:@"transform.rotation.z"];
  • 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-05-13T15:18:59+00:00Added an answer on May 13, 2026 at 3:18 pm

    You can use theLayer.transform or theLayer.affineTransform to get the current transform matrix (before the animation), then use iphone sdk CGAffineTransform getting the angle of rotation of an object to get the angle to start with.

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

Sidebar

Ask A Question

Stats

  • Questions 310k
  • Answers 310k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I've done this in project back in the 1.5 version… May 13, 2026 at 10:11 pm
  • Editorial Team
    Editorial Team added an answer You could try a pipelined function (here with a lateral… May 13, 2026 at 10:11 pm
  • Editorial Team
    Editorial Team added an answer go to developer center and use Certificate Assistant from there.… May 13, 2026 at 10:11 pm

Related Questions

I have an NSDocument which has the following structure: @interface MyDocument : NSDocument {
Surely there is a better way to do this? results = [] if not
I have two solutions in my workspace, say A and B. Solution A is
I'm using an extended version of BaseAdapter based on the EfficientAdapter example from the
I'm working on a very graphic-heavy application which uses content from a bunch of

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.