npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

anime-texty

v1.0.4

Published

This package provides many ways to animate your text. Please chackout the documentation.

Downloads

1

Readme

Description

  • This package provides many ways to animate your text. Please chackout the documentation.

Install

$ npm install anime-texty

Types of animations

  • Fade In: Make the text fade in.
  • Slide In: A function that animates the text sliding in from the left or right side of the screen.
  • Flip: A function that animates the text flipping over like a card.
  • Zoom In: A function that animates the text scaling up from a smaller size to its normal size.
  • Spin: A function that animates the text spinning around.
  • Bounce: A function that animates the text bouncing up and down.
  • Wiggle: A function that animates the text wiggling back and forth.
  • Typing: A function that animates the text as if it is being typed out.
  • Jumble: A function that animates the text as if it is being jumbled up and then rearranges itself to its original state.
  • Fade Out: A function that animates the text fading out to transparent.
  • Textillate: A function that animates the text with a combination of effects such as rotation, scale, skew, and more.
  • Rainbow: A function that animates the text with a rainbow color effect.
  • Parallax: A function that animates the text with a parallax effect, where the text appears to move at different speeds as the user scrolls the page.
  • Pulse: A function that animates the text with a pulsing effect, growing and shrinking repeatedly.
  • Skew: A function that animates the text with a skew effect, making it look tilted.
  • Blur: A function that animates the text with a blur effect, making it look out of focus.
  • Glitch: A function that animates the text with a glitch effect, making it look like it's malfunctioning.
  • Shatter: A function that animates the text as if it's shattering into pieces.
  • 3D rotate: A function that animates the text with a 3D rotation effect.
  • Fly in: A function that animates the text flying in from the top or bottom of the screen.
  • Text Gradient: A function that animates the text with a gradient effect, changing the text's color over time.
  • Text Shadow: A function that animates the text with a shadow effect, changing the text's shadow over time.
  • Flicker: A function that animates the text with a flicker effect, making it look like it's flickering.

Example 1

In order to use your npm package in a React application, you'll need to first install it in your project using npm or yarn. Once the package is installed, you can import the animation functions you want to use in your React components.

  • Here's an example of how you could use the "slideIn" animation function in a React component:
import React, { useEffect } from 'react';
import { slideIn } from 'anime-texty';

function MyComponent() {
    let textRef = React.createRef();

    useEffect(() => {
        slideIn(textRef.current, 'left');
    }, []);

    return (
        <div ref={textRef}>Animated Text</div>
    );
}

export default MyComponent;
  • In this example, the MyComponent uses the useEffect hook to call the slideIn animation function and pass the div's ref as an argument after the component has rendered.

Example 2

You can also use useState to control the animation by using state variable to control the animation and call the animation function on state change.

import React, { useEffect, useState } from 'react';
import { slideIn } from 'anime-texty';

function MyComponent() {
    let textRef = React.createRef();
    const [isAnimating, setAnimating] = useState(false);

    useEffect(() => {
        if(isAnimating){
            slideIn(textRef.current, 'left');
        }
    }, [isAnimating]);

    return (
        <div>
            <div ref={textRef}>Animated Text</div>
            <button onClick={() => setAnimating(!isAnimating)}>Toggle animation</button>
        </div>
    );
}
export default MyComponent;
  • In this example, you can see how you can use state variable to control the animation and call animation function on state change.

  • Keep in mind that you may need to make additional adjustments to the code depending on the specific requirements of your project, but this should give you a good starting point for using your npm package in a React application.

Example 3

To add the animations to a specific div in an HTML file, you can pass the div's id or class as an argument to the animation functions.

  • For example, if you have a div with the id of "animated-text", you can call the "slideIn" animation function like this: slideIn(document.getElementById('animated-text'), 'left');

  • Here's an example of how you could create a simple HTML file that uses the npm package to apply different animations to a specific div:

<!DOCTYPE html>
<html>
<head>
    <title>Animations Example</title>
</head>
<body>
    <div id="animated-text">Animated Text</div>
    <button id="slide-in-left">Slide In (Left)</button>
    <button id="slide-in-right">Slide In (Right)</button>
    <button id="zoom-in">Zoom In</button>
    <button id="spin">Spin</button>
    <script src="index.js"></script>
    <script>
        // Get the animated text div and the buttons
        let animatedText = document.getElementById('animated-text');
        let slideInLeft = document.getElementById('slide-in-left');
        let slideInRight = document.getElementById('slide-in-right');
        let zoomIn = document.getElementById('zoom-in');
        let spin = document.getElementById('spin');

        // Add event listeners to the buttons to apply the animations
        slideInLeft.addEventListener('click', () => slideIn(animatedText, 'left'));
        slideInRight.addEventListener('click', () => slideIn(animatedText, 'right'));
        zoomIn.addEventListener('click', () => zoomIn(animatedText));
        spin.addEventListener('click', () => spin(animatedText));
    </script>
</body>
</html>
  • In this example, you can see how you can use the id of a div to select it and apply animation function to it. You can also add more buttons and event listeners to apply different animations to the same div or to different divs.