0.0.5 • Published 6 years ago

react-letter-morph v0.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

react-letter-morph Build Status

React Letter Morph :sparkles: Inspired by https://events.google.com/io2016/

NPM

Demo

Example

Usage

import React, { Component } from 'react';
import LetterMorph from 'react-letter-morph';

class App extends Component {
  render() {
    return (
      <LetterMorph
        words={['I', 'LOVE', 'YOU']}
        colors={'#ff0049', '#ffffff'}
    );
  }
}

export default App;

Options

Letter Morph

PropTypeDescriptionDefault
words (required)array of stringsWords that you want letter morph to transition from and to
colorsarray of stringsarray of css colors that the letters will be drawn in[]
heightnumberheight of the rendered canvas (px)200
widthnumberwidth of the rendered canvas (px)500
fontUrlstringurl or path of the font. Can be .WOFF, .OTF, .TTFbelow
fontSizenumbersize of the font (px)200
lineWidthnumberthickness of the outlines (px)2
periodnumberhow long it takes for words to transition (smaller the faster)2
speednumberhow long it takes for color to transition (smaller the faster)2
stepsnumbersteps in each period (smaller the more efficient but rougher animations)500
styleobjectinline css styling for the canvas element{ position: 'relative' }

Default font url

https://fonts.gstatic.com/s/pacifico/v9/yunJt0R8tCvMyj_V4xSjafesZW2xOQ-xsNqO47m55DA.woff

Troubleshooting

I can't see the animation make sure your height and width are large enough that the animation is displayed

It's just black set the colors prop

Contributing

After cloning the repository and running npm install inside, you can use the following commands to develop and build the project.

# Starts a webpack dev server that hosts a demo page with the component.
# It uses react-hot-loader so changes are reflected on save.
npm start

# Start the storybook, which has several different examples to play with.
# Also hot-reloaded.
npm run storybook

# Runs the library tests
npm test

# Lints the code with eslint
npm run lint

# Lints and builds the code, placing the result in the dist directory.
# This build is necessary to reflect changes if youre
#  `npm link`-ed to this repository from another local project.
npm run build

Pull requests are welcome!

License

MIT

Credits