Custom Label to apply animations on whole text or letters.

Overview

Ophiuchus

Yalantis Preview The Green Horse

Custom Label to apply animations on whole text or letters.

Yalantis

Check an article on our blog

Inspired by this project on Dribble

Installation

CocoaPods

pod 'Ophiuchus', '~> 1.0.3'

Manual Installation

Alternatively you can directly add all the source files from Ophiuchus to your project.

  1. Download the latest code version or add the repository as a git submodule to your git-tracked project.
  2. Open your project in Xcode, then drag and drop all folders directories in Pods/Classes/ onto your project (use the "Product Navigator view"). Make sure to select Copy items when asked if you extracted the code archive outside of your project.
  3. Include YALLabel wherever you need it with #import "YALLabel.h".

Introduction

YALProgressAnimatingLayer

YALProgressAnimatingLayer is a subclass of CAShapeLayer designed to control animations with progress. This feature is disabled until you invoke [layer allowProgressToControlAnimations], after that duration and timeOffset properties of the layer will be passed to any animation added to the layer. Thus you gain control over animations added to the layer by passing values to progress property (varies from 0.f to 1.f). YALProgressAnimatingLayer mask is of same type as the layer.

YALTextLayer

YALTextLayer is a subclass of YALProgressAnimatingLayer designed to display array of UIBezierPath instances as YALProgressAnimatingLayer sublayers. You can access and manipulate each letter sublayer. YALTextLayer constructs sublayers with mask of bounding box of shapes they have by default.

YALLabel

YALLabel is a custom label consisting of three YALTextLayer instances to draw background fill, stroke and fill of text.

Usage

Drop a UIView on a storyboard and set it's class to YALLabel and configure fontName, fontSize, text, strokeWidth and colors.

You can #import "YALLabel.h" in your view controller and create it from code :

self.yalLabel = [[YALLabel alloc] initWithFrame:frame];
self.yalLabel.text = @"AnyText";
self.yalLabel.fontName = @"FontName";
self.yalLabel.fontSize = 60.f;
self.yalLabel.fillColor = [UIColor redColor];
self.yalLabel.backgroundFillColor = [UIColor blackColor];
self.yalLabel.strokeColor = [UIColor blackColor];
self.yalLabel.strokeWidth = 1.2f;

After self.yalLabel is drawn you can add any animations to any sublayer you want.

Example: add fill animation to mask as in example but only to first letter: Don't forget to import YALPathFillAnimation.h.

YALProgressAnimatingLayer *firstLetter = [self.yalLabel.fillLayer.sublayers firstObject];
CABasicAnimation *fillAnimation = [YALPathFillAnimation animationWithPath:fillLayer.mask.path andDirectionAngle:0];
fillAnimation.duration = 3.0;

[firstLetter.mask addAnimation:fillAnimation forKey:@"fillAnimation"];

You can also animate layer with progress:

YALProgressAnimatingLayer *secondLetter = self.yalLabel.fillLayer.sublayers[1];
CABasicAnimation *colorAnimation = [CABasicAnimation animationWithKeyPath:@"fillColor"];

colorAnimation.fromValue = (id)[UIColor redColor].CGColor;
colorAnimation.toValue = (id)[UIColor blueColor].CGColor;

[secondLetter allowProgressToControlAnimations];
[secondLetter addAnimation:colorAnimation forKey:@"colorAnimation"];

secondLetter.progress = 0.f;

And then when you need to update progress:

YALProgressAnimatingLayer *secondLetter = self.yalLabel.fillLayer.sublayers[1];
secondLetter.progress = value;

Let us know!

We’d be really happy if you senв us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding the animation.

P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for iOS (Android) better than better. Stay tuned!

License

The MIT License (MIT)

Copyright © 2017 Yalantis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

You might also like...
Swift UIView for sliding text with page indicator
Swift UIView for sliding text with page indicator

SlidingText for Swift Requirements Requires iOS 8 or later and Xcode 6.1+ Installation SlidingText is available through CocoaPods. To install it, simp

Letters animation allows you to click on different letters and accordingly it will animate letters in a cool way. It has a very attractive UI and is very easy to use.
Letters animation allows you to click on different letters and accordingly it will animate letters in a cool way. It has a very attractive UI and is very easy to use.

Letters Animation Cool Letters Animation in iOS written in Swift. Preview Table of content :- Description How to add in your project Requirement Licen

A Swift library to take the power of UIView.animateWithDuration(_:, animations:...) to a whole new level - layers, springs, chain-able animations and mixing view and layer animations together!
A Swift library to take the power of UIView.animateWithDuration(_:, animations:...) to a whole new level - layers, springs, chain-able animations and mixing view and layer animations together!

ver 2.0 NB! Breaking changes in 2.0 - due to a lot of requests EasyAnimation does NOT automatically install itself when imported. You need to enable i

DGFadingLabel - A custom UILabel that fades away the end of your text when text is too large to fit within the label's frame
DGFadingLabel - A custom UILabel that fades away the end of your text when text is too large to fit within the label's frame

A custom UILabel that fades away the end of your text when text is too large to fit within the label's frame.

Animated Mask Label is a nice gradient animated label.
Animated Mask Label is a nice gradient animated label.

Animated Mask Label Demo Screen Screenshot Demo/Example For demo: $ pod try AnimatedMaskLabel To run the example project, clone the repo, and run pod

SwiftUI Animation Library. Useful SwiftUI animations including Loading/progress, Looping, On-off, Enter, Exit, Fade, Spin and Background animations that you can directly implement in your next iOS application or project. The library also contains huge examples of spring animations such as Inertial Bounce, Shake, Twirl, Jelly, Jiggle, Rubber Band, Kitchen Sink and Wobble effects. Browse, find and download the animation that fits your needs.
An iOS application for remembering to take your medications. (Pronounced like the letters R-X.)

Arex An iOS application for remembering to take your medications. Downloading The following commands will set up an Arex checkout. You'll need Xcode o

Word Scramble is a game that requires you to build as many new words as possible using the letters from a root word
Word Scramble is a game that requires you to build as many new words as possible using the letters from a root word

Word Scramble is a game that requires you to build as many new words as possible using the letters from a root word.

Bond is a Swift binding framework that takes binding concepts to a whole new level.

Bond, Swift Bond Update: Bond 7 has been released! Check out the migration guide to learn more about the update. Bond is a Swift binding framework tha

Whole, half or floating point ratings control written in Swift
Whole, half or floating point ratings control written in Swift

FloatRatingView A simple rating view for iOS written in Swift! Supports whole, half or floating point values. I couldn't find anything that easily set

Whole, half or floating point ratings control written in Swift
Whole, half or floating point ratings control written in Swift

FloatRatingView A simple rating view for iOS written in Swift! Supports whole, half or floating point values. I couldn't find anything that easily set

Elegant Apply Style by Swift Method Chain.🌙
Elegant Apply Style by Swift Method Chain.🌙

ApplyStyleKit ApplyStyleKit is a library that applies styles to UIKit using Swifty Method Chain. Normally, when applying styles to UIView etc.,it is n

Drag gesture modifier to easily apply to any view.

SwiftUIDragModifier A description of this package. This is my first SwiftUI Package. It provides a quick way to make any SwiftUI View draggable. After

Elegant Apply Style by Swift Method Chain.🌙
Elegant Apply Style by Swift Method Chain.🌙

ApplyStyleKit ApplyStyleKit is a library that applies styles to UIKit using Swifty Method Chain. Normally, when applying styles to UIView etc.,it is n

iOS app built with UIKit and programatic auto-layouts to learn and apply knowledge. Offline storage using CoreData and Caching

PurpleImage Search Pixabay for images and save them offline to share and view To use: Clone the GitHub project, build and run in Xcode. The API is com

An instagram-like image editor that can apply preset filters passed to it and customized editings to a binded image.
An instagram-like image editor that can apply preset filters passed to it and customized editings to a binded image.

CZImageEditor CZImageEditor is an instagram-like image editor with clean and intuitive UI. It is pure swift and can apply preset filters and customize

A beautiful and flexible text field control implementation of
A beautiful and flexible text field control implementation of "Float Label Pattern". Written in Swift.

SkyFloatingLabelTextField SkyFloatingLabelTextField is a beautiful, flexible and customizable implementation of the space saving "Float Label Pattern"

A beautiful and flexible text field control implementation of
A beautiful and flexible text field control implementation of "Float Label Pattern". Written in Swift.

SkyFloatingLabelTextField SkyFloatingLabelTextField is a beautiful, flexible and customizable implementation of the space saving "Float Label Pattern"

More powerful label, attributed string builder and text parser.

DDText More powerful label, attributed string builder and text parser. DDLabel More powerful label than UILabel, using TextKit. It supports features b

Comments
  • Top to Bottom / Bottom to Top Animation

    Top to Bottom / Bottom to Top Animation

    Hi, is it possible to have some guidelines regarding the way to implement the first animation displayed? The one that fills the letters from bottom to top or top to bottom alternatively. Thx very much

    opened by stefanocdn 2
  • Upgrade fix easy warnings

    Upgrade fix easy warnings

    Several versions of Xcode since the last update, here are some basic changes to the project file.

    Note that this raises the deployment target, although only for the example project.

    opened by charliewilliams 0
  • Fix NaN crash

    Fix NaN crash

    The example crashes because iOS now checks the CALayer position doesn't contain NaN values. This PR checks for NaN before assigning to the layer position.

    opened by charliewilliams 0
Owner
Yalantis
Knowledge is power and the way to get power is by sharing knowledge. We are open source because this is a smart way to live, work and play.
Yalantis
Configurable morphing transitions between text values of a label.

TOMSMorphingLabel Configurable morphing transitions between text values of a label. Triggering the animation is as easy as setting the labels text pro

Tom König 1.9k Nov 20, 2022
NumberMorphView a view like label for displaying numbers which animate with transition using a technique called number tweening or number morphing.

NumberMorphView a view like label for displaying numbers which animate with transition using a technique called number tweening or num

Abhinav Chauhan 1.6k Dec 21, 2022
A triangle shaped corner label view for iOS written in Swift.

A triangle shaped corner label view for iOS written in Swift. This view is a subclass of UIView. It can be created and customized from the Storyboard

Mukesh Thawani 167 Nov 30, 2022
Animate numeric value while setting new value to label

NumericAnimatedLabel Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements Installati

Javal Nanda 28 Oct 11, 2021
A faster and more flexible label view for iOS

STULabel is an open source iOS framework for Swift and Objective-C that provides a label view (STULabel), a label layer (STULabelLayer) and a flexible

Stephan Tolksdorf 96 Dec 22, 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
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
Lightweight library to set an Image as text background. Written in swift.

Simple and light weight UIView that animate text with an image.

Lucas Ortis 552 Sep 9, 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
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