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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T10:31:22+00:00 2026-05-15T10:31:22+00:00

Hi I have two CALayers (*layer1 and *layer2). What I want is to start

  • 0

Hi I have two CALayers (*layer1 and *layer2). What I want is to start the animation on layer2 when 50% of the layer1’s animation time has elapsed. How can I achieve that?

I tried using CAAnimationGroup but that works only for animations in the same layer. I have found a workaround in which you have to add the delayed animation to a group first and set the beginTime property but this seems a little hackish to me and I would like to know if there is a right way of achieving what I want.

Thank you!

  • 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-15T10:31:22+00:00Added an answer on May 15, 2026 at 10:31 am

    The method of adding the second animation to a group does feel like a bit of a hack, but it works and is perfectly acceptable. What you could do instead if you prefer, though, is call -performSelector:withObject:afterDelay. Something like this:

    - (void)startFirstAnimation;
    {
        CGFloat duration = 10.0;
    
        CABasicAnimation *firstAnim = 
                 [CABasicAnimation animationWithKeyPath:@"position"];
        [firstAnim setFromValue:
                 [NSValue valueWithCGPoint:CGPointMake(30.0f, 30.0f)]];
        [firstAnim setToValue:
                 [NSValue valueWithCGPoint:CGPointMake(200.0f, 200.0f)]];
        [firstAnim setDuration:duration];
    
        [firstLayer addAnimation:firstAnim forKey:nil];
    
        [self performSelector:@selector(startSecondAnimation) 
                   withObject:nil afterDelay:duration/2.0]; 
    }
    
    - (void)startSecondAnimation;
    {
        CABasicAnimation *secondAnim = 
                 [CABasicAnimation animationWithKeyPath:@"position"];
        [secondAnim setFromValue:
                 [NSValue valueWithCGPoint:CGPointMake(100.0f, 30.0f)]];
        [secondAnim setToValue:
                 [NSValue valueWithCGPoint:CGPointMake(200.0f, 200.0f)]];
        [secondAnim setDuration:5.0];
    
        [secondLayer addAnimation:secondAnim forKey:nil];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two animations for two layers, layer1 and layer2, each has different path.
Have two fields start and end, both are dates, I want to write a
I have two functions that make $.getJSON calls - one looks at JSON stored
I have a CALayer that I want to animate across the screen. I have
I have two classes Order and Items I want a method like this class
I have two inputs with the same date, but i want to separate the
Have two events: $('body').mouseup(function(e){} and $('.toggle').click(function(e){} I only want one of these to trigger.
Have two separate databases. The master that holds the user information(username, password, address etc.).
Have two issues one is showFromToolbar statement format warning issue and another is that
I have an iPad app that has draggable UIViews contained in a larger parent

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.