This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function initDebug() {( | |
| _debug = new Mesh( | |
| new BoxGeometry(.25, .25, .5, 1, 1, 5), | |
| new Shader("DebugCamera", { | |
| uColor: { | |
| value: new Color, | |
| transparent: !0, | |
| depthTest: !1 | |
| } | |
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Curve3D { | |
| constructor() { | |
| this.arcLengthDivisions = 200 | |
| } | |
| getPointAt(u) { | |
| let t = this.getUtoTmapping(u); | |
| return this.getPoint(t) | |
| } | |
| getPoints(divisions = 5) { | |
| let points = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function initScene() { | |
| _triangleGeometry = World.QUAD, _luminosityShader = _this.initClass(Shader, "UnrealBloomLuminosity", { | |
| tDiffuse: { | |
| value: null, | |
| ignoreUIL: !0 | |
| }, | |
| luminosityThreshold: { | |
| value: 1 | |
| }, | |
| smoothWidth: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // normalizing trigonometry functions (t is between 0 -1): | |
| const t = (1 + Math.sin(clock.getElapsedTime())) / 2 | |
| // to alter speed | |
| Math.sin(clock.getElapsedTime() / 2) // 2 times slower | |
| Math.sin(clock.getElapsedTime() * 2) // 2 times faster |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * extractPathsFromSvg | |
| * Handles extracting paths from an svg string | |
| * @param {string} svg | |
| */ | |
| const extractPathsFromSvg = (svg) => { | |
| const pathSegmentPattern = /d="([a-z][^a-z]*)[^"]/gi | |
| return svg.match(pathSegmentPattern).map((str) => str.replace('d="', '')) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // main sphere rotates following the mouse position | |
| useFrame(({ clock, mouse }) => { | |
| main.current.rotation.z = clock.getElapsedTime(); | |
| main.current.rotation.y = THREE.MathUtils.lerp( | |
| main.current.rotation.y, | |
| mouse.x * Math.PI, | |
| 0.1 | |
| ); | |
| main.current.rotation.x = THREE.MathUtils.lerp( | |
| main.current.rotation.x, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default function Stars({ count = 5000 }) { | |
| const positions = useMemo(() => { | |
| let positions = [] | |
| for (let i = 0; i < count; i++) { | |
| const r = 4000 | |
| const theta = 2 * Math.PI * Math.random() | |
| const phi = Math.acos(2 * Math.random() - 1) | |
| const x = r * Math.cos(theta) * Math.sin(phi) + (-2000 + Math.random() * 4000) | |
| const y = r * Math.sin(theta) * Math.sin(phi) + (-2000 + Math.random() * 4000) | |
| const z = r * Math.cos(phi) + (-1000 + Math.random() * 2000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Cube() { | |
| const cam = useRef() | |
| const [scene, target] = useMemo(() => { | |
| const scene = new THREE.Scene() | |
| scene.background = new THREE.Color('orange') | |
| const target = new THREE.WebGLRenderTarget(1024, 1024) | |
| return [scene, target] | |
| }, []) | |
| useFrame(state => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Swarm({ count, mouse }) { | |
| const mesh = useRef() | |
| const light = useRef() | |
| const { size, viewport } = useThree() | |
| const aspect = size.width / viewport.width | |
| const dummy = useMemo(() => new THREE.Object3D(), []) | |
| // Generate some random positions, speed factors and timings | |
| const particles = useMemo(() => { | |
| const temp = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div className={styles.rain}> | |
| <div className={styles.drop}></div> | |
| <div className={styles.waves}> | |
| <div></div> | |
| <div></div> | |
| </div> | |
| <div className={styles.particles}> | |
| <div></div> | |
| <div></div> | |
| <div></div> |