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

animatedtxt

v1.3.6

Published

This npm package provides components and methods for convenient creation of animated texts and characters.

Downloads

18

Readme

AnimatedTXT

This npm package provides components and methods for convenient creation of animated texts and characters.

Live demo:

https://codesandbox.io/s/animatedtxt-0s5259

Installation

npm i animatedtxt

Usage

Importing components:

import { Phrase, Char } from 'animatedtxt';

Creating single character:

<Char char='A' />

Grouping multiple characters into a phrase

<Phrase>
	<Char char='A' />
	<Char char='B' />
	<Char char='C' />
</Phrase>

Custom Char

You can also provide your custom definition of the character for the <Char> component:

// Some custom definition
const customH: SvgChar = {
	svgViewBox: { width: 69, height: 81 },
	elements: [
		{
			elementDelay: 0.0,
			shape:
				'M 24 10 C 11 3 38 -4 33 7 C 19 36 19 56 13 65 C 1 89 -4 58 12 52 C 35 42 47 35 58 7 C 60 1 51 -4 52 11 C 53 34 37 49 40 76 C 42 92 47 44 68 58',
			length: 322.86358642578125,
		},
	],
	offsets: {
		left: [0, 0, 0, 0, 0],
		right: [0, 0, 0, 0, 0],
	},
};

// Example of usage
<Char char={customH} font='basic-thin' size={500} delay={1} />;

API

Char:

Behavior and design of a single character (not embedded into a phrase) can be modified by passing following props:

  • char <string> - character to be rendered. Each font has its own limitations for allowed characters.
  • delay? <number> - number of seconds by which the start of animation will be delayed. Default value: 0.
  • duration? <number> - duration of the animation in seconds. Default value: 1.
  • color? <string> - definition of the color of the character. Should be in format accepted by CSS standards. Default value: #000000.
  • size? <number> - size of the character in "px" unit. Default value: 100.
  • font? <string> - name of the font. Each font has different design of characters and may have different characters available. Default value: "basic-bold".
  • cubicBezier? <[number, number, number, number]> - definition of a Cubic Bezier curve used for animation-timing-function property. If not provided then linear function is used.
  • isReversed? <boolean> - flag that determines whether animation should be reversed. If true, animation is played backwards thus the character is disappearing. Default value: false.

Example:

<Char
	char='A'
	delay={1.5}
	duration={0.8}
	color='#6600cc'
	size={300}
	font='basic-thin'
	cubicBezier={[0.68, 0.04, 0.45, 0.98]}
/>

Phrase:

Behavior and design of characters grouped in the phrase can be modified by passing following props:

  • margin? <number> - number of pixel "px" units between characters in a phrase. Default value: 0.
  • color? <string> - definition of the color of the characters in a phrase. Should be in format accepted by CSS standards. Default value: #000000. Value is overwritten by the color defined in the character element.
  • size? <string> - size of the characters in "px" unit. Default value: 100. Value overwrites size value of all children elements.
  • duration? <number> - duration of the animation in seconds. Default value: 1. Value is overwritten by the value defined in the character element.
  • delay? <number> - number of seconds by which the start of the phrase animation will be delayed. When specified, this value is added to the delay of each Char component within the Phrase. Default value: 0.
  • font? <string> - name of the font. Each font has different design of characters and may have different characters available. Default value: "basic-bold". Value overwrites size value of all children elements.
  • cubicBezier? <[number, number, number, number]> - definition of a Cubic Bezier curve used for animation-timing-function property. If not provided then linear function is used. Value is overwritten by the value defined in the character element.
  • isReversed? <boolean> - flag that determines whether animation should be reversed. If true, animation is played backwards thus the character is disappearing. Default value: false. Value overrides children property.

Example:

<Phrase
	color='#6600cc'
	margin={50}
	size={200}
	duration={1.1}
	font='basic-thin'
	cubicBezier={[0.68, 0.04, 0.45, 0.98]}
>
	<Char char='A' />
	<Char char='B' />
	...
</Phrase>