const render = () => { this._requestAnimationFrameID = requestAnimationFrame(render); const now = 0.001 * global.nativePerformanceNow(); const dt = typeof lastFrameTime !== 'undefined' ? now - lastFrameTime : 0.16666; this.renderer.render(this.scene, camera); // NOTE: At the end of each frame, notify `Expo.GLView` with the below gl.endFrameEXP(); lastFrameTime = now; }
async addItems(newItems) { for (let i = 0; i < newItems.length; i++) { await new Promise((resolve) => requestAnimationFrame(resolve)); runInAction(() => { this.data.push(newItems[i]); }); await new Promise((resolve) => { setTimeout(resolve, this.delay); }); } }
function renderLoop(timestamp) { running = true; let repeat = 0; // Run global effects globalEffects.forEach(effect => effect(timestamp) && repeat++); roots.forEach(root => { const state = root.containerInfo.__state; // If the frameloop is invalidated, do not run another frame if (state.current.active && state.current.ready && (!state.current.invalidateFrameloop || state.current.frames > 0)) repeat = renderGl(state, timestamp, repeat); }); if (repeat !== 0) return requestAnimationFrame(renderLoop); // Flag end of operation running = false; }
makeHandleCameraStream() { return (images, updatePreview, gl) => { const loop = async () => { const nextImageTensor = images.next().value; // const predictions = await this.state.model.estimateHands(nextImageTensor); const predictions = await this.state.model.predict(nextImageTensor); this.setState({predictions}) requestAnimationFrame(loop); }; loop(); }; }
async removeItems() { for (let i = this.data.length; i > 0; i--) { await new Promise((resolve) => requestAnimationFrame(resolve)); runInAction(() => { this.data.pop(); }); await new Promise((resolve) => { setTimeout(resolve, this.delay); }); } }
requestAnimationFrame(()=>{ if(t == 0) { this.refs.scrollViewZj.scrollTo(0, 0); } else { this.refs.scrollViewJc.scrollTo(0, 0); } this._getData(0); });
dequeueActions() { const action = this.actionQueue.shift(); if (!action) { return; } requestAnimationFrame(() => { action(); this.dequeueActions(); }); }
requestAnimationFrame(() => { if(t == 0 && this.state.switchIndex == i) return; if(t == 1 && this.state.switchIndex2 == i) return; this._reset(t); if(t == 0) { this.setState({switchIndex: i}); } else { this.setState({switchIndex2: i}); } this._delayLoading(); });
updateRoute(route, backRoute) { let title = route.title; if (typeof title == 'function') { title = title(route); } requestAnimationFrame(() => { this.setState({title, backRoute, isMenuOpen: false}); }); }
const render = () => { requestAnimationFrame(render); renderer.render(scene, camera); gl.endFrameEXP(); }
requestAnimationFrame(() => { this._getData(true); if(loadingCate) { this._getCate(); } });
componentDidMount() { global.tracker.trackScreenView("Camera") requestAnimationFrame(() => { // update the camera state here or send a value to a function that changes the cameraEnabled state this.setState({ cameraEnabled: true }) }) }
finishTransition() { requestAnimationFrame(() => { this.props.onTransition(false); }); }
componentDidUpdate() { this.animationFrameWaiter = requestAnimationFrame(() => { this.measureView(); }); // report back ticks this.reportTicks(); }
static display(error) { // TODO: log this requestAnimationFrame(() => { Alert.alert( 'error', error, [ {text: 'ok'} ] ); }); }