鍍金池/ 問(wèn)答/HTML5  Linux  HTML/ 請(qǐng)問(wèn)react怎么實(shí)現(xiàn)動(dòng)畫(huà)暫停/繼續(xù)?

請(qǐng)問(wèn)react怎么實(shí)現(xiàn)動(dòng)畫(huà)暫停/繼續(xù)?

AnimationPlayState: 'paused'在ios上失效,所以打算棄之,我看到一個(gè)大神的解決方法https://codepen.io/HaoyCn/pen...,但是不知道在react上怎么寫(xiě),求指點(diǎn)!

<div style={this.props.clickonthe ? {
    AnimationPlayState: 'running',
    WebkitAnimationPlayState: 'running',

} : {
        AnimationPlayState: 'paused',
        WebkitAnimationPlayState: 'paused',

    }}>
回答
編輯回答
六扇門

最后按這個(gè)來(lái)的,還可以。
https://jsfiddle.net/shy2850/...

2017年9月23日 06:02
編輯回答
詆毀你

知道react的state不?操作它就可以了。

2017年6月16日 08:06
編輯回答
生性
constructor(props) {
  super(props);
  this.state = {
    isPlay: false
  };
}

/**
* click function
*/
playFn(){
    this.setState({
        !this.state.isPlay
    })
}

render(){
    return(
        <div onClick={this.playFn} className={this.state.isPlay?"animation":"noAnimation"}></div>
    )
}

2018年9月4日 14:45