Core animation

My Research-notes on core animation

Through sheer persistence/stubbornness I got CVDisplayLink working in swift with CALayer and CGContext (The holy grail of OSX/iOS animation) also added this to vimeo 60 frames per sec. Silky smooth animation. Next up is trying it with some interactions as well. Also need to test it with Gradient etc. And path shifting.

CATransition doesn’t really animate the properties, rather it crossfades 2 graphic states. To animate properties take a look at this link: Listening for progress callbacks and vimeo link

The example above shows the humble beginnings of color tweening CA Layer CGContext (CATransition)

Content of page


Syntax Idea for implementing css animation with StyleKit: CSS:

Button:over {/*<--animate when the button is in this state*/
  animation-name: Property;
  animation-duration: 3s;/*the duration of the anim*/
  animation-name: slidein;/*<--ref your anim link here*/

@keyframes slidein {/*<--this is the link id to the anim*/
  from {/*<--from this state*/
    margin-left: 100%;
    width: 300%;
  to {/*<--to this state*/
    margin-left: 0%;
    width: 100%;

Note: the anim name can be used for the listeners in swift end and began listeners etc Note: you may also add easing and other properties. Do more research into the correct props etc


/*Nothing yet*/


  • CADisplayLink: A CADisplayLink object is a timer object that allows your application to synchronize its drawing to the refresh rate of the display. CADisplayLink highly useful when the animation you want to create in an iOS app is something not easily handled by transitions or stock animations. CADisplayLink works very much like an NSTimer. You can set it to call a method on every tick, but instead of setting a time interval, the time interval is determined by the screen’s refresh rate. apple also has some info: apple CADisplayLink You can also use timeStamp and duration to skip frames if the framerate drops etc. Or set the frameRate it self to 30fps. You cant go above 60fps it seems. Aka the native device fps. ==CADisplayLink gives us a much better resolution that a NSTimer== to measure percentage complete use: percentComplete = elapsedTime / animationDuration;

  • CAKeyframeAnimation

  • CAMediaTiming

  • actionForLayer it seems that this is the method you override if you want to animate custom properties This has an example

  • CABasicAnimation

  • What not todo: 1000++ lines of code to make a tiny animation. surly this should be handled by an animation suite that defines your anim in an xml like structure and then uses a Util method to play the sequence. You even have code on how to implement this.

turn of implicit anim and


  • Is there any onAnimEnded and onAnimBegan call-backs? A: animationDidStart, animationDidStop
  • Keyframe anim for your SVG keyframe anim idea
  • Animating color.
  • ==Add a Selector hock into the mover class so that you can get the movementStopped call==
  • try to animate a path transformation from rect to round rect. and find that path anim link
  • try animating from a gradient to another. Use the green gradient to orange.
  • Look in the awesome swift repos for elastic rubberBand animation and frame-animation etc
  • Research CADisplayLink CVDisplayLink for OSX <- looks important (CADisplayLink is for IOS)
  • look through your books
  • look into gamedev for inspiration.
  • Find IOS and OSX game books
  • ==Try to implement the CADisplayLink with the log10 anim for easing==
  • Find the info on how to morph between bezier shapes (event with different anchor points)
  • do this tutorial: super simple CADisplayLink tutorial
  • Watch the Session 421 - Core Animation Essentials video from WWDC 2011 this was a waste of time. shallow anim concepts only
  • read this on removeOnComplete bug
  • look into that cocoapod UI example website. Find the link first maybe
  • I think you need to watch the CALAyer WWDC videos again. To get the animation working.
  • see if you can resize frame.
  • see if you can make a fps ticker with CVDisplayLink
  • check what other frameworks are using facebook pop <– apparently they are doing it wrong, twui, framerjs<-not swift or objc, ~~cosmicminds UI ~~ <– they use stock animation


Foundation Animation: Making Things Move!

Foundation Game Design ==(has Bouncing and gravity chapters)==


  • Basic core anim:
  • Some nice core anim features:
  • Gradient animation (This is for the CAGradientLayer so not really usefull):
  • identifying onComplete when using many animations:
  • Listening for progress callbacks
  • HitTesting animated layers: also a pdf copy here:
  • log10 rubber band anim example: log10 anim
  • Another CADisplayLink tutorial
  • Watch the Session 421 - Core Animation Essentials video from WWDC 2011. It’s only an hour and it is extremely informative.
  • super simple CADisplayLink tutorial

Animation inspiration:

  • wobbly interface:
  • nice pull to refresh tutorial:
  • facebook image paning tutorial from the app paper:
  • Text drawing animation from real text:
  • interesting playback scrubber for ios:
  • parallax animation tutorial:
  • UIKit dynamics:
  • More nuanced info on CADisplayLink:
  • This framework for IOS uses CADisplayLink and also has easing:
  • video player with cadisplaylink
  • performance testing cadisplaylink on mobile devices (Layer Trees vs. Flat Drawing ):
  • Discussion on swift and CVDisplayLink open gl and using NSTimer as a substitute:
  • GrandCentralDispatch based timer, for async timing: (can be used for frame anim)
  • This code works in swift:
  • indepth discussion about CVDisplayLink and CALAyer:

CPU Threading

  • I depth analysis of the state of UI CPU Threading: pdf copy here