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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:34:25+00:00 2026-05-26T13:34:25+00:00

I am animating a UIView along a circle using a CAKeyframeAnimation that follows a

  • 0

I am animating a UIView along a circle using a CAKeyframeAnimation that follows a CGPathAddEllipseInRect. However, the view always seems to start in the same place regardless of the frame it is originally positioned in. Is there some way to adjust the starting position of the view on the path?

Thanks!

CAKeyframeAnimation *myAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
myAnimation.fillMode = kCAFillModeForwards;
myAnimation.repeatCount = 5;
myAnimation.calculationMode = kCAAnimationPaced;
myAnimation.duration = 10.0;

CGMutablePathRef animationPath = CGPathCreateMutable();

CGPathAddEllipseInRect(animationPath, NULL, rect);

myAnimation.path = animationPath;
CGPathRelease(animationPath);

[view.layer addAnimation:myAnimation forKey:@"changeViewLocation"];
  • 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-26T13:34:25+00:00Added an answer on May 26, 2026 at 1:34 pm

    I don’t think it’s possible to set a start point for CGPathAddEllipseInRect. (At least i wasn’t successful)

    instead of using: CGPathAddEllipseInRect,
    You should use: CGPathAddArc! For example:

    CAKeyframeAnimation *myAnimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
    myAnimation.fillMode = kCAFillModeForwards;
    myAnimation.repeatCount = 5;
    myAnimation.calculationMode = kCAAnimationPaced;
    myAnimation.duration = 10.0;
    
    CGMutablePathRef animationPath = CGPathCreateMutable();
    
    NSInteger startVal = M_PI / 2;
    
    //seventh value (end point) must be always 2*M_PI bigger for a full circle rotation
    CCGPathAddArc(animationPath, NULL, 100, 100, 100,  startVal, startVal + 2*M_PI, NO); 
    
    myAnimation.path = animationPath;
    CGPathRelease(animationPath);
    
    [view.layer addAnimation:myAnimation forKey:@"changeViewLocation"];
    

    will rotate full circle starting from bottom – clockwise. Change startVal value to change rotation start position. (full rotation is 2*M_PI).

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

Sidebar

Related Questions

I'm animating a UIView's frame property using a CAKeyframeAnimation on the view's CALayer and
I have a UIView instance that I am animating using CAKeyframeAnimation . It is
I'm using UIView's + animateWithDuration:delay:options:animations:completion: method to move my view along a line over
I want it to be animated so I'm using [UIView beginAnimations] I've tried animating
I'm animating a UIView by updating its anchorpoint 60 times a second using an
I have a UIView that contains a couple UIButtons that I am animating from
I am animating a UIView that contains a graph drawn with CGPath elements myView.frame=CGRectMake(0,0,1024,768);
I'm having this problem with a CAKeyframeAnimation. After animating the layer of a UIView,
I'm noticing that UIView animations using the UIView class methods seem to more or
I am using the following code for animating a UIView indefinitely: #define DEFAULT_ANIM_SPPED 0.6

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.