React native 如何获得一致的闪烁效果
我需要有一个一致的“眨眼”在非常快的速度,它在低速工作 但是当使用定时器速度<50时,我会出现一些不一致的闪烁 所以我的问题是,我能得到的最大FPS闪烁是多少?如何使闪烁保持一致 这里是我的基本闪烁代码React native 如何获得一致的闪烁效果,react-native,frame-rate,React Native,Frame Rate,我需要有一个一致的“眨眼”在非常快的速度,它在低速工作 但是当使用定时器速度
<View style={styles.container} backgroundColor = {this.state.torchStatus ? '#FF0000' : '#00FF00'}>
以60fps的速度反应本机渲染。
您可以尝试将计时器速度设置为17(1000/60=16.666)
<View style={styles.container} backgroundColor = {this.state.torchStatus ? '#FF0000' : '#00FF00'}>
timer = () => {
let time = 100;
timer.setInterval(this, 'torch',
() => this.setState({
torchStatus:!this.state.torchStatus},
),
time);
}