Coder Social home page Coder Social logo

naasser055 / iosdrawtextanimation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from franklinsch/iosdrawtextanimation

0.0 0.0 0.0 346 KB

A UILabel subclass with stroke drawing animations, and customization options

License: MIT License

Swift 94.01% Objective-C 5.99%

iosdrawtextanimation's Introduction

UIStrokeAnimatedLabel (Swift)

A UILabel subclass with stroke drawing animations, with customization options

A UIStrokeAnimatedLabel is a UILabel that has a stroke animation when displayed. Animation duration, stroke width and spacing and easily customizable through Interface Builder or programatically.

UIStrokeAnimatedLabel Demo

Installation

Build and link the UIStrokeAnimatedLabel framework (UIStrokeAnimatedLabel/UIStrokeAnimatedLabelFramework.xcodeproj).

Alternatively, copy UIStrokeAnimatedLabel/UIStrokeAnimatedLabel/UIStrokeAnimatedLabel.swift directly in your project.

Usage and customization

A UIStrokeAnimatedLabel can be created and customized through Interface Builder or programmatically.

Interface Builder

  1. Drag a UILabel into a view.
  2. Set the label's class to UIStrokeAnimatedLabel. You might also need to set the Module name to UIStrokeAnimatedLabelFramework if using CocoaPods.

UIStrokeAnimatedLabel Interface Builder Setup

Customize the label using the Attributes inspector. From there, animation duration and stroke color can be modified.

UIStrokeAnimatedLabel Interface Builder Customization

Programmatically

Create IBOutlets or create the labels programatically.

@IBOutlet weak var swiftLabel: UIStrokeAnimatedLabel!
@IBOutlet weak var rocksLabel: UIStrokeAnimatedLabel!

override func viewDidLoad() {
  super.viewDidLoad()

    swiftLabel.animationDuration = 1.0
    rocksLabel.animationDuration = 2.0

    swiftLabel.strokeWidth = .relative(scale: 1.4)
    rocksLabel.strokeColor = .gray
    swiftLabel.characterSpacing = .absolute(value: 20.0)
    rocksLabel.wordSpacing = .relative(scale: 0.5)

    rocksLabel.animationEnabled = true
    
    rocksLabel.completionHandler = {
      print("Animation complete")
    }
}

License

MIT, see LICENSE for details.

iosdrawtextanimation's People

Contributors

franklinsch avatar frogg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.