我想在一个屏幕上同时使用react-native-gl-model-view 中的2 个“3d 对象模型” 。当我使用单个 3d 对象时,它工作正常,但一旦我使用两个或两个以上,每个 3d 对象模型就会开始闪烁,几秒钟后应用程序崩溃。
这是它如何处理多个 3d 对象
这是代码:
import React, {Component} from 'react';
import {StyleSheet, View, Animated} from 'react-native';
import ModelView from 'react-native-gl-model-view';
const AnimatedModelView = Animated.createAnimatedComponent(ModelView);
export default class Multiple extends Component {
constructor() {
super();
this.state = {
rotateZ: new Animated.Value(0),
};
}
componentDidMount() {
this.animate(0);
}
animate(iteration) {
Animated.timing(this.state.rotateZ, {
toValue: ++iteration * 360,
useNativeDriver: true,
duration: 5000,
}).start(this.animate.bind(this, iteration++));
}
renderModel() {
return (
<AnimatedModelView
model={{
uri: 'demon.obj',
}} …Run Code Online (Sandbox Code Playgroud)