0.0.3 • Published 6 years ago

type-machine v0.0.3

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

TypeMachine 是一个 React 组件,通过简单的配置就能实现打字效果。

npm.io

Usage

npm install type-machine
import React form 'react'
import TypeMachine from 'type-machine'

class Demo extends React.Component {
  render () {
    const texts = [
        [{ string: '第一行', color: 'red' }],
        [{ string: '第二行' }, { string: '同行换色', color: 'yellow' }]
      ]
    return (
      <TypeMachine texts={texts} speed={500} defaultColor='#BBB' />
    )
  }
}
export default Demo

npm.io

API

参数类型
textsArray
speedNumber
defaultColorString

texts

texts = [
  [{string: ‘第一行’}],
  [{string: ‘第二行’}, {string: '同行变色’, color: ‘red’}],
  [string: ‘换行变色’, color: ‘yellow']
]

speed

两个字符间隔时间(ms)

defaultColor

rgb(a, b, c) || #FFF || black
0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago