
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
rc-css-animate
Advanced tools
Minimal react animation components. You need to use css to achieve animation effects. Component only provides explicit and implicit control and animation completion callback.
Read this in other languages: English
极简 react 动画组件。需要利用 css 实现动画效果。组件只提供显隐控制和动画完成回调。
开发历程可以参考博客 手写一个 React 动画组件
npm install rc-css-animate
或者
yarn install rc-css-animate
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| tag | 字符串(div)或者 React 组件 | any | div |
| clsPrefix | css 动画 class 前缀 | string | '' |
| animateCls | css 动画 class(有前缀会添加前缀) | string | '' |
| className | tag 组件 className | string | '' |
| style | tag 组件 style | CSSProperties | undefined | undefined |
| childredn | 子组件,无需特意传递 | ReactNode | - |
| initialVisible | 初始是否展现 | boolean | true |
| onAnimationEnd | 动画结束回调 | () => void | null |
| getVisibleWhenAnimateEnd | 获取动画结束后组件是否展现函数,如果返回 false,则不会显示该组件 | (cls: string) => boolean | null |
import React from "react";
import ReactCssAnimate from "rc-css-animate";
// 引入 animate.css 辅助动画
import "animate.css";
function App() {
return (
<div className="App">
<ReactCssAnimate
tag="div"
clsPrefix="animate__"
// 当前 tag 的 className 和 style
className=''
style={{}}
// 当前动画
animateCls="animated backInDown infinite"
initialVisible={false}
getVisibleWhenAnimateEnd={(cls) => {
// 如果当前 className 中有 Out
// 返回 false 则会在动画结束后不再显示
if (cls.includes("Out")) {
return false;
}
return true;
}}
// 动画结束回调
onAnimationEnd={() => {
console.log("done");
}}
>
<div>
测试动画
</div>
</ReactCssAnimate>
</div>
);
}
export default App;
使用自己定义的组件传入以及设置全局 prefix
import React from "react";
import ReactCssAnimate, { setPrefixCls } from "rc-css-animate";
import "animate.css";
// 设置全局 prefix,会被当前组件覆盖
setPrefixCls("animate__");
function Block(props) {
// 别忘记放入 style、 className 和 children
const { className, children, style } = props;
return (
<div
className={className}
style={{
background: "red",
padding: 100,
...style
}}
>
{children}
</div>
);
}
function App() {
return (
<div className="App">
<ReactCssAnimate
tag={Block}
// 当前动画
animateCls="animated backInDown infinite"
initialVisible={false}
getVisibleWhenAnimateEnd={(cls) => {
// 如果当前 className 中有 Out
// 返回 false 则会在动画结束后不再显示
if (cls.includes("Out")) {
return false;
}
return true;
}}
// 动画结束回调
onAnimationEnd={() => {
console.log("done");
}}
>
<div>
测试动画
</div>
</ReactCssAnimate>
</div>
);
}
不支持 hooks 的版本
// 导入兼容的组件
import { CompatibleRAnimate as ReactCssAnimate } from "rc-css-animate";
FAQs
Minimal react animation components. You need to use css to achieve animation effects. Component only provides explicit and implicit control and animation completion callback.
The npm package rc-css-animate receives a total of 5 weekly downloads. As such, rc-css-animate popularity was classified as not popular.
We found that rc-css-animate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.