react-smooth

react animation

Github星跟蹤圖

react-smooth

react-smooth is a animation library work on React.

npm version
build status
npm downloads
Gitter

install

npm install --save react-smooth

Usage

simple animation

<Animate to="0" from="1" attributeName="opacity">
  <div />
</Animate>

steps animation

const steps = [{
  style: {
    opacity: 0,
  },
  duration: 400,
}, {
  style: {
    opacity: 1,
    transform: 'translate(0, 0)',
  },
  duration: 1000,
}, {
  style: {
    transform: 'translate(100px, 100px)',
  },
  duration: 1200,
}];

<Animate steps={steps}>
  <div />
</Animate>

children can be a function

<Animate from={{ opacity: 0 }}
  to={{ opacity: 1 }}
  easing="ease-in"
  >
  {
    ({ opacity }) => <div style={{ opacity }}></div>
  }
</Animate>

you can configure js timing function

const easing = configureBezier(0.1, 0.1, 0.5, 0.8);
const easing = configureSpring({ stiff: 170, damping: 20 });

group animation

const appear = {
  from: 0,
  to: 1,
  attributeName: 'opacity',
};

const leave = {
  steps: [{
    style: {
      transform: 'translateX(0)',
    },
  }, {
    duration: 1000,
    style: {
      transform: 'translateX(300)',
      height: 50,
    },
  }, {
    duration: 2000,
    style: {
      height: 0,
    },
  }]
}

<AnimateGroup appear={appear} leave={leave}>
  { list }
</AnimateGroup>

/*
 *  @description: add compatible prefix in style
 *
 *  style = { transform: xxx, ...others };
 *
 *  translatedStyle = {
 *    WebkitTransform: xxx,
 *    MozTransform: xxx,
 *    OTransform: xxx,
 *    msTransform: xxx,
 *    ...others,
 *  };
 */

const translatedStyle = translateStyle(style);


API

Animate

AnimateGroup

License

MIT

Copyright (c) 2015-2016 Recharts Group

主要指標

概覽
名稱與所有者tylerchilds/cutestrap
主編程語言CSS
編程語言JavaScript (語言數: 3)
平台
許可證GNU General Public License v3.0
所有者活动
創建於2016-05-14 01:39:55
推送於2023-01-04 08:20:22
最后一次提交2020-10-08 22:10:31
發布數28
最新版本名稱v2.0.0-2 (發布於 2019-09-23 23:51:59)
第一版名稱v0.0.0 (發布於 )
用户参与
星數1.6k
關注者數36
派生數77
提交數96
已啟用問題?
問題數37
打開的問題數6
拉請求數17
打開的拉請求數12
關閉的拉請求數6
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?