Replies: 1 comment 1 reply
-
a couple of things:
import React, { useRef } from "react";
import { useFrame } from 'react-three-fiber';
// import { random } from 'lodash';
function FakeSphere (){
return (
<mesh>
<sphereBufferGeometry args={[0.7, 30, 30]} attach="geometry" />
<meshStandardMaterial color={0x394989} attach="material" metalness={1} />
</mesh>
);
};
export default function MyScene {
const randomOrNotSoRandomIntensity = 0.33;
const light = useRef()
useFrame(() => {
light.current.intensity = Math.random()
})
return (
<group>
<FakeSphere />
<ambientLight ref={light} intensity={randomOrNotSoRandomIntensity} />
<pointLight intensity={0.7} position={[0, 5, 0]} />
</group>
);
}; |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi guys, how can i change ambientLight based on clock? I might have a clue that is using useFrame hook but can't make this :(
My full code for this so far:
Beta Was this translation helpful? Give feedback.
All reactions