0.1.0 • Published 6 years ago

shape-overlay v0.1.0

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

ShapeOverlay

@ykob shape-overlays React 实现

Install

npm install shape-overlay --save

Usage

import react from 'react';
import ShapeOverlay from 'shape-overlay';

export default function TestComponent() {
  return (
    <ShapeOverlay open />
  );
}

API

PropsTypeDefaultDescription
openbooleannull声明式打开或者关闭动画层. 动画正在进行时改变此属性不会生效
pointCountnumber15每层的节点个数
durationnumber600单层动画完成时间, 总完成时间约为 duration + delayPerLayer layerCount + duration shapeRatio
timingFunctionenumcubicInOut动画函数, exponentialIn, exponentialOut, exponentialInOut, sineOut, circularInOut, cubicIn, cubicOut, cubicInOut, quadraticOut, quarticOut
shapeFunctionfunction曲线节点位置函数, (xPosition) => number. 输入, 返回值∈0, 1. 默认函数x => (Math.sin(x 8 Math.PI) + 1) / 2
shapeRationumber0.3遮罩曲线图形部分占图层最大比例
layerCountnumber1层数
layerColorsstring[][]每层的颜色
layerDelaynumber100每层展示延迟(millisecond)
onAnimationStartfunctionnull动画开始事件
onAnimationEndfunctionnull动画结束事件

Note: 动画进行中不要修改props. 勿谓言之不预也.

License

MIT