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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:07:20+00:00 2026-06-04T22:07:20+00:00

FUTURE VIEWERS: I have managed to finish this rotation animation and code with description

  • 0

FUTURE VIEWERS:

I have managed to finish this rotation animation and code with description can be found on tho question. NSImage rotation in NSView is not working

Before you proceed please up vote Duncan C ‘s answer. As I manage to achieve this rotation from his answer.


I have an image like this,

enter image description here

I want to keep rotating this sync icon, On a different thread. Now I tried using Quartz composer and add the animation to QCView but it is has very crazy effect and very slow too.

Question :

How do I rotate this image continuously with very less processing expense?

Effort

I read CoreAnimation, Quartz2D documentation but I failed to find the way to make it work. The only thing I know so far is, I have to use

  • CALayer
  • CAImageRef
  • AffineTransform
  • NSAnimationContext

Now, I am not expecting code, but an understanding with pseudo code will be great!

  • 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-04T22:07:22+00:00Added an answer on June 4, 2026 at 10:07 pm

    Getting an object to rotate more than 180 degrees is actually a little bit tricky. The problem is that you specify a transformation matrix for the ending rotation, and the system decides to rotate in the other direction.

    What I’ve done is to create a CABasicAnimation of less than 180 degrees, set up to be additive , and with a repeat count. Each step in the animation animates the object more.

    The following code is taken from an iOS application, but the technique is identical in Mac OS.

      CABasicAnimation* rotate =  [CABasicAnimation animationWithKeyPath: @"transform.rotation.z"];
      rotate.removedOnCompletion = FALSE;
      rotate.fillMode = kCAFillModeForwards;
    
      //Do a series of 5 quarter turns for a total of a 1.25 turns
      //(2PI is a full turn, so pi/2 is a quarter turn)
      [rotate setToValue: [NSNumber numberWithFloat: -M_PI / 2]];
      rotate.repeatCount = 11;
    
      rotate.duration = duration/2;
      rotate.beginTime = start;
      rotate.cumulative = TRUE;
      rotate.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
    

    CAAnimation objects operate on layers, so for Mac OS, you’ll need to set the “wants layer” property in interface builder, and then add the animation to your view’s layer.

    To make your view rotate forever, you’d set repeat count to some very large number like 1e100.

    Once you’ve created your animation, you’d add it to your view’s layer with code something like this:

    [myView.layer addAnimation: rotate forKey: @"rotateAnimation"];
    

    That’s about all there is to it.

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

Sidebar

Related Questions

In the near future, my organisation will have to change both the machine name
i have a date in the future and i want to find out how
It seems that in the future, we can just use the non-beta iPhone SDK
(Note to any future readers: The error, unsurprisingly, is in my code and not
In my future website, I'll have partners and I want them to receive a
When future-proofing code by testing it on PHP 5.4, I get a warning I
How can I future-proof my client URL links to my server for future HTTPS
I'm studying for future interviews and I wanted to know something. I have an
I have a date in the future e.g. 13/10/2008 I need to subtract the
In the future, will managed runtimes provide additional protections against subtle data corruption issues?

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.