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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:13:05+00:00 2026-05-25T20:13:05+00:00

Do you know how to create an animation like the Blue Marble drop User-Location

  • 0

Do you know how to create an animation like the Blue Marble drop User-Location in MKMapView?

  • 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-25T20:13:05+00:00Added an answer on May 25, 2026 at 8:13 pm

    Although I am not sure on the specifics of how Apple accomplished this effect, this feels to me like a great opportunity to use CoreAnimation and custom animatable properties. This post provides some nice background on the subject. I assume by the “Blue Marble drop” animation you’re referring to the following sequence:

    1. Large light blue circle zooms into frame
    2. Large light blue circle oscillates between two relatively large radii as location is
      calculated
    3. Large light blue circle zooms into small darker blue circle on the user’s location

    Although this may be simplifying the process slightly, I think it’s a good place to start and more complex/detailed functionality can be added with relative ease (i.e. the small dark circle pulsing as larger circle converges on it.)

    The first thing we need is a custom CALayer subclass with a custom property for our outer large light blue circles radius:

    #import <QuartzCore/QuartzCore.h>
    
    @interface CustomLayer : CALayer
    @property (nonatomic, assign) CGFloat circleRadius;
    @end
    

    and the implementation:

    #import "CustomLayer.h"
    
    @implementation CustomLayer
    @dynamic circleRadius; // Linked post tells us to let CA implement our accessors for us.
                           // Whether this is necessary or not is unclear to me and one 
                           // commenter on the linked post claims success only when using
                           // @synthesize for the animatable property.
    
    + (BOOL)needsDisplayForKey:(NSString*)key {
        // Let our layer know it has to redraw when circleRadius is changed
        if ([key isEqualToString:@"circleRadius"]) {
            return YES;
        } else {
            return [super needsDisplayForKey:key];
        }
    }
    
    - (void)drawInContext:(CGContextRef)ctx {
    
        // This call is probably unnecessary as super's implementation does nothing
        [super drawInContext:ctx];
    
        CGRect rect = CGContextGetClipBoundingBox(ctx);
    
        // Fill the circle with a light blue
        CGContextSetRGBFillColor(ctx, 0, 0, 255, 0.1);
        // Stoke a dark blue border
        CGContextSetRGBStrokeColor(ctx, 0, 0, 255, 0.5);
    
        // Construct a CGMutablePath to draw the light blue circle
        CGMutablePathRef path = CGPathCreateMutable();
        CGPathAddArc(path, NULL, rect.size.width / 2, 
                                 rect.size.height / 2, 
                                 self.circleRadius, 0, 2 * M_PI, NO);
        // Fill the circle
        CGContextAddPath(ctx, path);
        CGContextFillPath(ctx);
    
        // Stroke the circle's border
        CGContextAddPath(ctx, path);
        CGContextStrokePath(ctx);
    
        // Release the path
        CGPathRelease(path);
    
        // Set a dark blue color for the small inner circle
        CGContextSetRGBFillColor(ctx, 0, 0, 255, 1.0f);
    
        // Draw the center dot
        CGContextBeginPath (ctx);
        CGContextAddArc(ctx, rect.size.width / 2, 
                             rect.size.height / 2, 
                             5, 0, 2 * M_PI, NO);
        CGContextFillPath(ctx);
        CGContextStrokePath(ctx);
    
    }
    
    @end
    

    With this infrastructure in place, we can now animate the radius of the outer circle with ease b/c CoreAnimation will take care of the value interpolations as well as redraw calls. All we have to do his add an animation to the layer. As a simple proof of concept, I chose a simple CAKeyframeAnimation to go through the 3 stage animation:

    // In some controller class...
    - (void)addLayerAndAnimate {
    
        CustomLayer *customLayer = [[CustomLayer alloc] init];
    
        // Make layer big enough for the initial radius
        // EDIT: You may want to shrink the layer when it reacehes it's final size
        [customLayer setFrame:CGRectMake(0, 0, 205, 205)];
        [self.view.layer addSublayer:customLayer];
    
    
        CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"circleRadius"];
    
        // Zoom in, oscillate a couple times, zoom in further
        animation.values = [NSArray arrayWithObjects:[NSNumber numberWithFloat:100], 
                                                     [NSNumber numberWithFloat:45], 
                                                     [NSNumber numberWithFloat:50], 
                                                     [NSNumber numberWithFloat:45], 
                                                     [NSNumber numberWithFloat:50], 
                                                     [NSNumber numberWithFloat:45], 
                                                     [NSNumber numberWithFloat:20], 
                                                      nil];
        // We want the radii to be 20 in the end
        customLayer.circleRadius = 20;
    
        // Rather arbitrary values.  I thought the cubic pacing w/ a 2.5 second pacing
        // looked decent enough but you'd probably want to play with them to get a more
        // accurate imitation of the Maps app.  You could also define a keyTimes array for 
        // a more discrete control of the times per step.
        animation.duration = 2.5;
        animation.calculationMode = kCAAnimationCubicPaced;
    
        [customLayer addAnimation:animation forKey:nil];
    
    }
    

    The above is a rather “hacky” proof of concept as I am not sure of the specific way in which you intend to use this effect. For example, if you wanted to oscillate the circle until data was ready, the above wouldn’t make a lot of sense because it will always oscillate twice.

    Some closing notes:

    • Again, I am not sure of your intent for this effect. If, for
      example, you’re adding it to an MKMapView, the above may require
      some tweaking to integrate with MapKit.
    • The linked post suggests the above method requires the version of CoreAnimation in iOS 3.0+ and OS X 10.6+
    • Speaking of the linked post (as I did often), much credit and thanks to Ole Begemann who wrote it and did a wonderful job explaining custom properties in CoreAnimation.

    EDIT: Also, for performance reasons, you’re probably going to want to make sure the layer is only as big as it needs to be. That is, after your done animating from the larger size, you may want to scale the size down so you’re only using/drawing as much room as necessary. A nice way to do this would be just to find a way animate the bounds (as opposed to circleRadius) and perform this animation based the size interpolation but I’ve had some trouble implementing that (perhaps someone could add some insight on that subject).

    Hope this helps,
    Sam

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

Sidebar

Related Questions

I would like to create an animation which enables the user to go backward
I know how to create a custom user control in WPF but how can
Anyone know how to create a division like the the ones used in Google
I'll like to know if there is a way to create a ImageIcon that
I would like to know which method should I choose when trying to create
I want to create a window and show some image display (like animation based
I would like create an animation like the iOS 5 banner notifications, but i
I'd like to create an animation on a website to mimic a scrolling log
What kind of skills should a WPF developer know to create MVVM applications? Things
I know how to create a SEL at compile time using @selector(MyMethodName:) but what

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.