Giter Site home page Giter Site logo

lerist / ghosttypewriter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wibosco/ghosttypewriter

0.0 1.0 0.0 274 KB

A UILabel subclass that adds a ghost type writing animation effect.

Home Page: http://williamboles.me/

License: Other

Swift 93.51% Ruby 3.84% Objective-C 2.65%

ghosttypewriter's Introduction

Build Status Version License Platform CocoaPods

A UILabel subclass that adds a type writing animation effect. The interesting thing about this pod is that the characters will not jump around as they are animated onto the screen instead the characters will be animated onto the screen in their final position - this especially important for multiple line text as the jump can be very visually displeasing.

This pod was inspired by the following post here.

##Installation via CocoaPods

To integrate CoreDataServices into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'

pod 'GhostTypewriter'

Then, run the following command:

$ pod install

CocoaPods 1.1.1+ is required to build GhostTypewriter.

##Usage

Animated Typing

TypewriterLabel is a subclass of UILabel and where the animation (magic) happens. It works by taking advantage of the attributedText property on the label and changing the properties of the text content to gradually expose the text using an animation similar to what you get on a mechanical type writer.

####Starting

import GhostTypewriter

@IBAction func startAnimationButtonPressed(_ sender: Any) {
    self.descriptionLabel.startTypewritingAnimation(completion: nil)
}

####Stoping

import GhostTypewriter

@IBAction func startAnimationButtonPressed(_ sender: Any) {
	if animating {
		descriptionLabel.stopTypewritingAnimation()
	} else {
		self.descriptionLabel.startTypewritingAnimation(completion: nil)
	}
}

####Canceling

import GhostTypewriter

@IBAction func startAnimationButtonPressed(_ sender: Any) {
	if animating {
		descriptionLabel.cancelTypewritingAnimation()
	} else {
		self.descriptionLabel.startTypewritingAnimation(completion: nil)
	}
}

####Chaining animations

import GhostTypewriter

@IBAction func startAnimationButtonPressed(_ sender: Any) {
    titleLabel.cancelTypewritingAnimation()
    descriptionLabel.cancelTypewritingAnimation()
    
    titleLabel.startGhostTypewriterAnimation {
        self.descriptionLabel.startTypewritingAnimation(completion: nil)
    }
}

####Adjusting animation timing

import GhostTypewriter

override func viewDidLoad() {
	super.viewDidLoad()
	titleLabel.typingTimeInterval = 0.3
}

####Storyboards

As TypewriterLabel contained in a pod, when using it in your storyboards you will need to use the Module field with the value GhostTypewriter.

##Example

GhostTypewriter comes with an example project to provide more details than listed above.

##Found an issue?

Please open a new Issue here if you run into a problem specific to CoreDataServices, have a feature request, or want to share a comment. Note that general Core Data questions should be asked on Stack Overflow.

Pull requests are encouraged and greatly appreciated! Please try to maintain consistency with the existing code style. If you're considering taking on significant changes or additions to the project, please communicate in advance by opening a new Issue. This allows everyone to get onboard with upcoming changes, ensures that changes align with the project's design philosophy, and avoids duplicated work.

ghosttypewriter's People

Contributors

wibosco avatar zld avatar

Watchers

 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.