Code Monkey home page Code Monkey logo

staggertype's Introduction

StaggerType.js

Displays animated text by sequentially showing characters with easing methods. Can also display a string of random characters to create an old airport/train station display effect

Download

Minified (~2kb gzipped)

Usage:

StaggerType can be applied to any HTML element containing text

example HTML markup:

<div class="container">
    <p class="el">Lorem ipsum dolor sit amet.</p>
</div>
var element = document.querySelector('.el');

// instantiate a StaggerType instance, passing the text element and overriding some default options.
// see below for a list of all possible options
var staggerType = new StaggerType( element, {duration:1.5, ease: 'easeOutSine'} );
    staggerType.subscribe( staggerType.Events.FADE_IN_COMPLETE, onAnimationComplete)
    
var onAnimationComplete = function() {
    //do stuff
}

##Options

Option Type Default Description
autoStart Boolean true Wether or not to automatically start animating on instantiation
fps Number 60 frames per second. Lower numbers will cause the animation to play less smoothly
scrambleText Boolean true Show airport display style random letter effect
characters string ABCDEFGHIJK LMNOPQRSTUVWX YZabcdefgh ijklmnop qrstuvwxyz0123456789 string of characters to be used for random letter effect
ease string easeOutQuart easing function to be applied to the animation
duration Number 1 the total duration of the text animation
##Methods
###show()
Starts the animation if autoStart:false
###pause()
Pauses the animation
###resume()
resumes the animation if paused.
###on( type (string), handler (function) )
adds an event listener to staggertype
###off( type (string), handler (function) )

##Events ###StaggerType::fadeInComplete dispatched when the animation has finished playing

##Easing Use one of the easing methods below. A demo of each easing type can be found here

  • linearEase
  • easeInQuad
  • easeOutQuad
  • easeInOutQuad
  • easeInCubic
  • easeOutCubic
  • easeInOutCubic
  • easeInQuart
  • easeOutQuart
  • easeInOutQuart
  • easeInQuint
  • easeOutQuint
  • easeInOutQuint
  • easeInSine
  • easeOutSine
  • easeInOutSine
  • easeInExpo
  • easeOutExpo
  • easeInOutExpo
  • easeInCirc
  • easeOutCirc
  • easeInOutCirc

staggertype's People

Contributors

frontshift 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.