Reactjs 从React prop启动SVG动画
我想知道是否有一种方法可以从React中的道具开始动画Reactjs 从React prop启动SVG动画,reactjs,typescript,svg,Reactjs,Typescript,Svg,我想知道是否有一种方法可以从React中的道具开始动画 type ComponentProps= { startAnimation: boolean; } class Component extends React.PureComponent<ComponentProps> { ... render() { return <svg .. <animate begin={this.props.startAnimation
type ComponentProps= {
startAnimation: boolean;
}
class Component extends React.PureComponent<ComponentProps>
{
...
render()
{
return <svg
..
<animate begin={this.props.startAnimation ? What goes here? : "indefinite"} />
</svg>;
}
}
type ComponentProps={
startAnimation:布尔值;
}
类组件扩展了React.PureComponent
{
...
render()
{
return可能是您正在寻找的,并且没有太多的转换
只需将
更改为
等,您就可以使用它们的动画、隐藏和变体道具来启动/停止不同的动画。framer