UILabel replacement with fine-grain appear/disappear animation

Overview

ZCAnimatedLabel

UILabel-like view with easy to extend appear/disappear animation

Features

  • Rich text support (with NSAttributedString)
  • Group aniamtion by character/word/line
  • Customizable animation start delay for each text block
  • Great performance, only changed area is redrawn
  • Optional layer-based implementation
  • 3D/Geometry transform support (layer based only)
  • iOS 5+ compatibility

Demo

  • Default

image

  • Fall

image

  • Duang/Spring

image

  • Flyin

image

  • Focus

image

  • Shapeshift

image

  • Reveal

image

  • Thrown

image

  • Transparency

image

  • Spin

image

  • Dash

image

  • More to come

How to use

ZCAnimatedLabel is available via CocoaPods. If you don't need all the effect subclasses, simply drag ZCAnimatedLabel.(h|m), ZCCoreTextLayout.(h|m) and ZCEasingUtil.(h|m) into your project and start customizing your own.

Subclassing

ZCAnimatedLabel has two modes: non-layer based and layer based. In the first mode, ZCAnimatedLabel is a flat UIView, every stage of animation is drawn using Core Graphics, you can customize redraw area for your animation for better performance. Following methods can be overriden:

  • - (void) textBlockAttributesInit: (ZCTextBlock *) textBlock;
  • - (void) appearStateDrawingForRect: (CGRect) rect textBlock: (ZCTextBlock *) textBlock;
  • - (void) disappearStateDrawingForRect: (CGRect) rect textBlock: (ZCTextBlock *) textBlock;
  • - (CGRect) redrawAreaForRect: (CGRect) rect textBlock: (ZCTextBlock *) textBlock;

Second option is layer based, where each text block is a simple CALayer, 3D tranform is possible in this mode by setting layer's transform property, if redraw area is bigger and not too many text blocks, this can achive a performance gain. Set self.layerBased to YES and override following methods for customization:

  • - (void) textBlockAttributesInit: (ZCTextBlock *) textBlock;
  • - (void) appearStateLayerChangesForTextBlock: (ZCTextBlock *) textBlock;
  • - (void) disappearLayerStateChangesForTextBlock: (ZCTextBlock *) textBlock;

Todo

  • Merge CALayers no longer animating into a single backing store and reuse CALayer for animating layers. (Even better performance for layerBased implementation)
  • More Effects, possily glyph related ones
  • Use core animation emmiter

Thanks to

  • LTMorhpingLabel for heavy inspiration. If you like ZCAnimatedLabel, you should definitely this one out.
  • AGGeometryKit for arbitrary shape 3D transform code piece used in ZCDashLabel
Comments
  • Set Box Size before set text

    Set Box Size before set text

    I am using auto-layout so I need to set the box size before or at same time the text is set. Size to fit is not working for me, I don't know why.

    Because I am using NSAttributedText and oficial apple methods to get the proper size are not working always as expected, after researching I found this works great.

    Feel free to consider adding this to get the proper text size at setText time.

    CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((__bridge CFAttributedStringRef)attributedString);
    CGSize targetSize = CGSizeMake(320, CGFLOAT_MAX);
    CGSize fitSize = CTFramesetterSuggestFrameSizeWithConstraints(framesetter, CFRangeMake(0, [attributedString length]),NULL, targetSize, NULL);
    CFRelease(framesetter);
    
    opened by gastonmorixe 2
  • TextColor From CocoaPods

    TextColor From CocoaPods

    Really thanks for sharing this . But when I use Podfile to access this , my textColor is always black. Then I download it from github and copy lib to my project , my textColor change finally T_T

    opened by rex5207 1
  • Not working well for NSAttributedString.

    Not working well for NSAttributedString.

    NSAttributed text cut-off badly when Disappearing the animation. Like:

    I have write a Attribute text "yourself" with text size 72 with font name "Empire Crown Condensed" and struck size 2. While disappearing the animation with "ZCShapeshiftLabel" the text is cutting off.

    Another example is I did write the text: "The fact that you have a great way to keep it real by yourself " with font size more then 60 and font name "Ethnocentric". I am showing text 2 words at a time and it cuts off very badly with "ZCShapeshiftLabel" and "ZCDuangLabel" animation while Disappearing the text.

    Thanks.

    opened by gurjitdhiman 0
  • Cannot assign text

    Cannot assign text

    Hello, i decided to try this library which looked really awesome. I m working on swift 3, setted up a bridge , and imported all the h files on it I created label programatically, but i was not able to change the text of it. .text or .attributedString, neither of 2 label properties worked I understand this project is probably deprecated, but anyway this looks the only library which supports multi line labels, so i would really like to see it working. Thank you for attention

    opened by siideffect 2
  • ZCTransparencyLabel disappearance animation not working

    ZCTransparencyLabel disappearance animation not working

    I'm using ZCTransparencyLabel in my application, but apparently disappearance animation has some kind of bug since it just stops working in the middle of animation, then stuck for a moment and disappear completely.

    I wish somebody could look into that.

    opened by s1ddok 1
Owner
Chen
Chen
Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.

Atributika is an easy and painless way to build NSAttributedString. It is able to detect HTML-like tags, links, phone numbers, hashtags, any regex or

Pavel Sharanda 1.1k Dec 26, 2022
A drop-in replacement for UILabel that supports attributes, data detectors, links, and more

TTTAttributedLabel A drop-in replacement for UILabel that supports attributes, data detectors, links, and more TTTAttributedLabel is a drop-in replace

TTTAttributedLabel 8.8k Dec 30, 2022
Simple countdown UILabel with morphing animation, and some useful function.

CountdownLabel Simple countdown UILabel with morphing animation, and some useful function. features Simple creation Easily get status of countdown fro

keishi suzuki 903 Dec 29, 2022
Glitching UILabel for iOS 📺

Glitching UILabel for iOS ?? Created by Lee Sun-Hyoup. Try the sample $ pod try GlitchLabel Requirements iOS 8.0+ Swift 3 Xcode 8 Installation CocoaP

Lee Sun-Hyoup 1k Dec 14, 2022
Incrementable UILabel for iOS and tvOS

IncrementableLabel IncrementableLabel is the easiest way to have incrementable numbers in an UILabel! Usage let myIncrementableLabel = IncrementableLa

Tom Baranes 81 Feb 4, 2022
KDEDateLabel is an UILabel subclass that updates itself to make time ago's format easier.

KDEDateLabel KDEDateLabel is an UILabel subclass that saves you from refreshing it when using 'time ago' format. Installation You have multiple choice

Kevin Delannoy 117 May 16, 2022
A morphing UILabel subclass written in Swift.

LTMorphingLabel A morphing UILabel subclass written in Swift. The .Scale effect mimicked Apple's QuickType animation of iOS 8 of WWDC 2014. New morphi

Lex Tang 7.9k Jan 4, 2023
UILabel with image placed from left or right

SMIconLabel UILabel with possibility to place small icon on the left or on the right side. Take a look at preview image or build sample app to see how

Anatoliy Voropay 94 Apr 27, 2022
A handy class for iOS to use UILabel as a countdown timer or stopwatch just like in Apple Clock App.

MZTimerLabel Purpose MZTimerLabel is a UILabel subclass, which is a handy way to use UILabel as a countdown timer or stopwatch just like that in Apple

Mines Chan 1.6k Dec 14, 2022
UILabel subclass, which additionally allows shadow blur, inner shadow, stroke text and fill gradient.

THLabel THLabel is a subclass of UILabel, which additionally allows shadow blur, inner shadow, stroke text and fill gradient. Requirements iOS 4.0 or

Tobias Hagemann 654 Nov 27, 2022
MTLLinkLabel is linkable UILabel. Written in Swift.

# MTLLinkLabel is linkable UILabel. Written in Swift. Requirements iOS 8.0+ Xcode 7.3+ Installation Carthage You can install Carthage with Homebrew. $

Recruit Holdings. Media Technology Lab 74 Jul 1, 2022
Adds animated counting support to UILabel.

UICountingLabel Adds animated counting support to UILabel. CocoaPods UICountingLabel is available on CocoaPods. Add this to your Podfile: pod 'UICount

Tim Gostony 1.9k Dec 1, 2022
A simple designable subclass on UILabel with extra IBDesignable and Blinking features.

JSLabel Demo pod try JSLabel ...or clone this repo and build and run/test the JSLabel project in Xcode to see JSLabel in action. If you don't have Coc

Jogendra 6 May 9, 2022
Swift TTTAttributedLabel replacement

Nantes ?? This library is a Swift port/fork of the popular Objective-C library TTTAttributedLabel. Much ❤️ and credit goes to Mattt for creating such

Instacart 1k Dec 22, 2022
Secret app like text animation

RQShineLabel A UILabel subclass that lets you animate text similar to Secret app. Installation CocoaPods RQShineLabel is available through CocoaPods,

gk 2k Dec 6, 2022
OdometerLabel - SwiftUI number label with odometer animation

Пример Simulator.Screen.Recording.-.L.iPhone.12.-.2022-01-30.at.16.26.53.mp4

Misnikov Roman 2 Jun 13, 2022
An autolayout library for the damn fine citizens of San Diego.

Anchorman Do you think autolayout has to be hard? Nah. NSLayoutAnchor is pretty neat! But it's still a bit tedious of an API. Try writing .translatesA

Joe Fabisevich 79 May 25, 2022
UILabel drop-in replacement supporting Hashtags

ActiveLabel.swift UILabel drop-in replacement supporting Hashtags (#), Mentions (@), URLs (http://), Emails and custom regex patterns, written in Swif

Optonaut 4.2k Dec 31, 2022
Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.

Atributika is an easy and painless way to build NSAttributedString. It is able to detect HTML-like tags, links, phone numbers, hashtags, any regex or

Pavel Sharanda 1.1k Dec 26, 2022
Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.

Atributika is an easy and painless way to build NSAttributedString. It is able to detect HTML-like tags, links, phone numbers, hashtags, any regex or

Pavel Sharanda 1.1k Jan 8, 2023