Giter Site home page Giter Site logo

typewriting.js's Introduction

TypeWriting.js

npm version

https://unsplash.com/photos/E0Spm6XXn2Y

If you want to make the typing effect, this is what you need.

TypeWriting DEMO

Note: TypeWriting.js doesn't depend on jQuery since version 1.2. If you want to keep the old version, please check another branch - jQuery-v1.1.3.


Installation

Just clone or download the zip of this repository

or via npm:

$ yarn add typewriting

# $ npm install --save typewriting

Setup

<!-- just typewriting.js or .min.js -->
<script src='path/to/typewriting.min.js'></script>

or

// import in your .js file
import TypeWriting from 'typewriting';

TypeWriting()

  • targetElement: HTML element required
    Your element
  • inputString: String required
    Your text
  • typingInterval: Int
    Interval between each character
  • blinkInterval: String
    Interval of the cursor blinks
  • cursorColor: String
    Color of the cursor

I use the height of targetElement to set the cursor height. You could use its line-height to control cursor height.

Second parameter is the function after typing effect.

const typeWriting = new TypeWriting({
	targetElement   : document.getElementsByClassName('terminal')[0],
	inputString     : 'Hello, world.',
	typingInterval  : 130,
	blinkInterval   : '1s',
	cursorColor     : '#00fd55',
}, () => console.log('END'));

rewrite()

You could use this function to do the same effect but different text at same element.

typeWriting.rewrite('Welcome to TypeWriting.js', () => {
	console.log('Rewrite() is finished');
});

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.