Skip to content

Commit

Permalink
feat(performance): improve performance of threejs usages
Browse files Browse the repository at this point in the history
  • Loading branch information
blanxii committed Sep 22, 2023
1 parent 6326748 commit d37fcb1
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/App/App.component.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,10 @@
import React, { useState } from 'react';
import React from 'react';
import { Avatar } from 'src/components/Avatar';
import { Sparkles, StatsGl } from '@react-three/drei';
import { EnvironmentModel } from '../components/Models';
import styles from './App.module.scss';

function App() {
const [model, setModel] = useState('64d61e9e17883fd73ebe5eb7');
const models = ['64d61e9e17883fd73ebe5eb7', '64b650ef27e920b1c5ff9416'];
const getRandomValueFromArray = (arr: string | any[]) => {
const randomIndex = Math.floor(Math.random() * arr.length);
return arr[randomIndex];
};

setInterval(() => {
const newModel = getRandomValueFromArray(models);
console.log(newModel);
setModel(newModel);
}, 5000);
return (
<div className={styles.app}>
<div className={styles.settings}>
Expand All @@ -30,7 +18,7 @@ function App() {
<div className={styles.container}>
<div className={styles.card}>
<Avatar
modelSrc={`https://models.readyplayer.me/${model}.glb?morphTargets=ARKit,Eyes Extra&textureAtlas=none&lod=0`}
modelSrc="https://models.readyplayer.me/64d61e9e17883fd73ebe5eb7.glb?morphTargets=ARKit,Eyes Extra&textureAtlas=none&lod=0"
shadows
animationSrc="/male-idle-2.fbx"
style={{ background: 'rgb(9,20,26)' }}
Expand Down

0 comments on commit d37fcb1

Please sign in to comment.