Coder Social home page Coder Social logo

devoooooop / textify.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from maggix1404/textify-js

0.0 0.0 0.0 5.13 MB

Simple scroll based text reveal animation library.

Home Page: https://maggix1404.github.io/Textify.js/

License: MIT License

JavaScript 98.44% CSS 1.56%

textify.js's Introduction

Simple scroll based text reveal animation library.

maintained - yes contributions - welcome Made with JavaScript

โ›ฐ๏ธ
DEMO


Getting Started

Using packge manager

NPM

Install textify using npm:

npm install textify.js

yarn

Install textify using yarn

yarn add textify.js

Using CDN:

<link src="https://cdn.jsdelivr.net/npm/textify.js/dist/Textify.min.css" rel="stylesheet"/>

<script src="https://cdn.jsdelivr.net/npm/textify.js/dist/Textify.min.js"></script>

ES6 module

<script type="module">
    import textifyJs from 'https://cdn.jsdelivr.net/npm/textify.js/+esm';

    const { Textify } = textifyJs;

    new Textify();
</script>

Usage

Import Textify.js:

import Textify from "textify.js";

Link Textify.min.css to document:

<link src="https://cdn.jsdelivr.net/npm/textify.js/dist/Textify.min.css" rel="stylesheet"/>

Add data-textify attribute to your paragraph or an element that contain text.

<p data-textify>Some cool text.๐Ÿ˜Ž๐Ÿ˜Ž</p>

Initialize textify to see magic.

new Textify()

By default textify use default configurations for text animations. You can pass an configuration object during initialization to tweak it.

Configuration options

Option Default value Description
duration 1450 Duration of text animation in ms
stagger 100 Delay between animation of two lines. Value between 0 to 500 ms
fade false For fade animation.
fadeDuration 1000 Duration of fade animation in ms
top false Text reveal direction. Default is bottom to top
reveal true Text reveal animation
once true Whether animation should happen only once - while scrolling down
rotation 0 Add rotation on word in animation
scale 1 Add scaling on word in animation
easing Default Set easing function for animation
fadeEasing Default fade animation ease value
selector data-textify css selector for selecting elements from DOM
threshold 0.5 Threshold of the text animation
transformOrigin center center transform origin of animation's elements

Plugins

Textify.js have a plugin system. You can use it separate the code and make it more readable. You can use it to create custom animations of texts. currently, Textify.js have only 1 plugin. TextifyTitle plugin. we will add more plugins in the future.

TextifyTitle()

TextifyTitle plugin is used to create a title animation. it's a simple plugin. you can use it to create cool title animations. this plugin is used only for the title elements like H1, H2, H3, H4, H5 & H6. this plugin have same methods like Textify object. you can use them to control the animation. all methods are chainable. like show(), hide() & onRefresh().

   <h1 data-textify-title>
       Hello World!!!
   </h1>

   <script>
       new TextifyTitle();
   </script>

Documentation

Check main documentation of Textify.js here:

Methods

Textify object and it's all plugins have same methods.

  • show - Reveal animation.
  • hide - Hide animation.
  • onRefresh - Re-calulate all texts position and offset (call on DOM changes and resize event)

Example:

const textObj = new Textify();

// reveal all animations of textObj
textObj.show();

// hide all animations of textObj
textObj.hide();

// Re-calulate all texts position and offset
textObj.onRefresh();

Easing functions

  • easeInOut
  • easeOut
  • easeIn
  • ease
  • sharp
  • linear
  • back
  • backIn
  • backOut
  • backInOut
  • elasticIn
  • elasticOut
  • elasticInOut
  • bounceIn
  • bounceOut
  • bounceInOut
  • circIn
  • circOut
  • circInOut

Who's using Textify.js?

License

Released under MIT by @MAGGIx1404.

textify.js's People

Contributors

maggix1404 avatar dependabot[bot] avatar xdarksondagar avatar techsculptorx 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.