Git Product home page Git Product logo

motto's Introduction

MottoJS

Show your motto in an amazing way!

Visit Codepen live demo here

Installation

npm

npm install motto

or

git clone [email protected]:jrainlau/motto.git

Usage

create a html tag such as <h1></h1> etc

<h1 class="motto"></h1>

then include MottoJS

<script src="motto.min.js"></script>

MottoJS also support AMD, CommonJS and ES2015.

then use new to create a MottoJS instance

var motto = new Motto(el, config)

if you want to add the shake effect, you should link the motto.css to your HTML:

``` > and add a class `.motto-shake` to the element > ```

```

Params

MottoJS receive two params.

  • el {String / HTML element} required

use CSS selector to select a html element for showing the motto.

  • config {Object} required

it's an object with five optional properties.

Config

the base config object is

{
    lyric: 'To be or not to be, that\'s a question.',
    showUpSpeed: 1000,
    flashSpeed: 100,
    flashTimeout: 1000,
    callback: function() { ... }
}
  • lyric {String} optional default: ''

the text of your motto.

  • showUpSpeed {Number} optional default: 0

your motto will be a letter by letter on display, it's an option to control the speed.

  • flashSpeed {Number} optional default: 0

to control how fast will the messy code translate into meaningful motto.

  • flashTimeout {Number} optional default: 0

set the timeout between the messy code showed up and translated into meaningful motto.

  • callback {Function} optional default: {}

a callback function after translation.

Update

  • v1.0.1: added shake css effect.

License

MIT

motto's People

Contributors

jrainlau avatar

Watchers

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