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 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-kanji-animation

v1.3.0

Published

React Native Animation for Kanji strokes

Readme

react-native-kanji-animation

Installation

react-native-kanji-animation depends on react-native-svg for animation. If you have not installed react-native-svg, follow these instructions to install.

Install the library using npm or yarn:

# using npm
$ npm install react-native-kanji-animation --save

# using yarn
$ yarn add react-native-kanji-animation

Usage

import { Kanji } from 'react-native-kanji-animation';

render() {
  return (
    <Kanji
      ref={el => kanjiExample = el}
      element="書"
      size={90}
      placeholder={true}
      duration={700}
      step={6}
      onPress={() => kanjiExample.animate()}
    />
  );
}

Another Example

<Kanji
  ref={e => kanjiExample = e}
  element={'字'}
  size={200}
  pathProps={{
    strokeLinecap: 'square',
    strokeWidth: 5,
    stroke: 'red'
  }}
  placeholder={true}
  placeholderProps={{
    strokeLinecap: 'round',
    strokeWidth: 8,
    stroke: 'green'
  }}
  guideProps={{
    strokeWidth: 15,
    stroke: 'blue',
    strokeOpacity: 0.7
  }}
  duration={1000}
  step={0}
  onPress={() => {
    kanjiExample.animate({
      previousStep: false,
      step: 4
    });
  }}
/>

Reference

Props

| Name | Type | Default | Description | | ------------------------------ | ---------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | containerStyle | object | null | Style props for canvas | | easing | func | null | Easing function for the animation | | duration | number | 250 | Timing for the kanji animation every stroke (in ms) |
| element | string | REQUIRED | Kanji character to be drawn | | guideProps | object | null | Properties for Animation Guide based on Path Component of react-native-svg. Click here for more information. Recommended to use only stroke, strokeWidth, and strokeLinecap. | | onLongPress | func | null | Called when the character is long pressed |
| onPress | func | null | Called when the character is pressed |
| pathProps | object | null | Properties for Kanji stroke based on Path Component of react-native-svg. Click here for more information. Recommended to use only stroke, strokeWidth, and strokeLinecap. | | placeholder | bool | false | Kanji character to be drawn unaffected by the animation | | placeholderProps | object | null | Properties for Placeholder Kanji stroke based on Path Component of react-native-svg. Click here for more information. Recommended to use only stroke, strokeWidth, and strokeLinecap. |
| previousStep | bool | true | Show the previous stroke of the selected step. Will show the first until n-th stroke if it's true or only the n-th stroke if it's false | | size | number | 109 | The size (width and height) of the kanji character | | step | number | null | Indicating the current stroke. Show the first until n-th stroke (previousStep is true) or only the n-th stroke (previousStep is false). By default it will point to the last stroke. |

Methods

animate(options?, animationEndCallback?)

Starts the kanji stroke animation with an options and callback after the animation ends.

Options: | Name | Type | Description | | ------------------------------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | hideGuide | bool | Set to true to hide the Guide when the animation occurs | | previousStep | bool | Will show the animation of first until n-th stroke if it's true or only the n-th stroke if it's false. By default will be the same as props. | | step | number | Indicating the current stroke. Show the first until n-th stroke (previousStep is true) or only the n-th stroke (previousStep is false). By default will be the same as props. |

Example:

this.kanji.animate({
  step: 5,
  previousStep: true,
  hideGuide: true
}, () => console.log("animation finished"));
numOfStrokes()

Return number. Obtain the total number of stroke of the current kanji element.

Example:

console.log(this.kanji.numOfStrokes());
strokeProperties()

Return Array of SVGPathProperties. Obtain the SVG Path Properties for each stroke with the following methods:

  • getTotalLength: () => number;
  • getPointAtLength: (fractionLength: number) => Point;
  • getTangentAtLength: (fractionLength: number) => Point;
  • getPropertiesAtLength: (fractionLength: number) => PointProperties;
  • getParts: () => PartProperties[];

Example:

console.log(this.kanji.strokeProperties()[0].getTotalLength());