import React, { useRef } from 'react'; import { useFrame } from '@react-three/fiber'; import { Clouds as DreiClouds, Cloud } from '@react-three/drei'; import * as THREE from 'three'; import Rain from './Rain'; const Storm = () => { const cloudsRef = useRef(); const lightningLightRef = useRef(); const lightningActive = useRef(false); useFrame((state) => { // Lightning flash with ambient light if (Math.random() < 0.003 && !lightningActive.current) { lightningActive.current = true; if (lightningLightRef.current) { // Random X position for each flash const randomX = (Math.random() - 0.5) * 10; // Range: -5 to 5 lightningLightRef.current.position.x = randomX; // Single bright flash lightningLightRef.current.intensity = 90; setTimeout(() => { if (lightningLightRef.current) lightningLightRef.current.intensity = 0; lightningActive.current = false; }, 400); } } }); return ( ); }; export default Storm;