Latest 0.0.1
Homepage https://github.com/jpsim/JPSDisplayLink
License MIT
Platforms ios , requires ARC
Authors

JPSDisplayLink provides an easy block interface to CADisplayLink-based animations.

This is ideal for animating properties that don’t support UIView-based animations like font size on a UILabel or UITextView.

Installation

From CocoaPods

Add pod 'JPSDisplayLink' to your Podfile.

Manually

Important note if your project doesn’t use ARC: you must add the -fobjc-arc compiler flag to JPSDisplayLink.m in Target Settings > Build Phases > Compile Sources.

Drag the JPSDisplayLink/JPSDisplayLink folder into your project.

Usage

JPSDisplayLink only has one class method:

typedef void (^JPSDisplayLinkBlock)(CGFloat progress);

+ (void)runDisplayLinkWithDuration:(CFTimeInterval)duration block:(JPSDisplayLinkBlock)block;

A JPSDisplayLink object will be created and implicitly retained for the duration specified, then it is automatically released.

Make sure you follow proper block etiquette when using JPSDisplayLinkBlock: for example, avoid retain cycles.

Easing

Add easing to your JPSDisplayLink animations by manipulating the progress parameter in your animation block.

For example, to animate a font size with cubic ease in/out, add AHEasing to your project and use the following code:

[JPSDisplayLink runDisplayLinkWithDuration:5.0f block:^(CGFloat progress) {
    CGFloat easedProgress = CubicEaseInOut(progress);
    weakLabel.font = [UIFont boldSystemFontOfSize:12.0f + easedProgress*16.0f];
}];

Demo

See sample Xcode project in /JPSDisplayLinkDemo.

Here’s a GIF of the demo app in action. Note that the GIF’s framerate is much slower than in reality.

Demo GIF

License

This project is under the MIT license.

Latest podspec

{
    "name": "JPSDisplayLink",
    "version": "0.0.1",
    "platforms": {
        "ios": null
    },
    "license": "MIT",
    "summary": "JPSDisplayLink provides an easy block interface to CADisplayLink-based animations.",
    "homepage": "https://github.com/jpsim/JPSDisplayLink",
    "authors": {
        "JP Simard": "[email protected]"
    },
    "source": {
        "git": "https://github.com/jpsim/JPSDisplayLink.git",
        "tag": "0.0.1"
    },
    "description": "JPSDisplayLink provides an easy block interface to CADisplayLink-based animations. This is ideal for animating properties that dont support UIView-based animations like font size on a UILabel or UITextView.",
    "source_files": "JPSDisplayLink/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This