This file contains 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
import * as THREE from 'three' | |
import { Suspense, useRef, useState } from 'react' | |
import { Canvas, createPortal, applyProps, useFrame, useThree } from '@react-three/fiber' | |
import { useFBO, PerspectiveCamera, ScrollControls, Scroll, useScroll, Image } from '@react-three/drei' | |
function Images() { | |
const { width, height } = useThree(state => state.viewport) | |
const data = useScroll() | |
const group = useRef() | |
useFrame(() => { |
This file contains 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
// Authors: | |
// N8, https://twitter.com/N8Programs | |
// drcmda, https://twitter.com/0xca0a | |
// https://github.com/N8python/maskBlur | |
import * as THREE from 'three' | |
import * as React from 'react' | |
import { extend, useFrame, useThree } from '@react-three/fiber' | |
import { useFBO } from './useFBO' | |
import { RenderTexture } from './RenderTexture' |
This file contains 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
// assuming "geo", a THREE.BufferGeometry | |
geo.computeBoundingBox() | |
geo.computeVertexNormals() | |
let bboxSize = geo.boundingBox.getSize(new THREE.Vector3()) | |
let uvMapSize = Math.min(bboxSize.x, bboxSize.y, bboxSize.z) | |
// calculate UV coordinates, if uv attribute is not present, it will be added | |
let boxGeometry = new THREE.BoxGeometry(uvMapSize, uvMapSize, uvMapSize) | |
let cube = new THREE.Mesh(boxGeometry) |
This file contains 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
import { Suspense, createContext, useTransition, useState, useContext, useMemo } from 'react' | |
import debounce from 'lodash/debounce' | |
const pendingContext = createContext() | |
export function Pending({ fallback, debounce, children }) { | |
return ( | |
<Suspense fallback={fallback}> | |
<PendingChildren debounce={debounce}>{children}</PendingChildren> | |
</Suspense> | |
) |
This file contains 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
import { useEffect, useLayoutEffect, useReducer, useRef } from 'react' | |
import shallowEqual from './shallowEqual' | |
const useIsomorphicLayoutEffect = | |
typeof window !== 'undefined' ? useLayoutEffect : useEffect | |
export type State = Record<string, any> | |
export type StateListener<T extends State, U = T> = (state: U) => void | |
export type StateSelector<T extends State, U> = (state: T) => U | |
export type PartialState<T extends State> = |
This file contains 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
// Only export the things that are actually needed, cut out everything else | |
export { WebGLRenderer } from 'three/src/renderers/WebGLRenderer.js' | |
export { ShaderLib } from 'three/src/renderers/shaders/ShaderLib.js' | |
export { UniformsLib } from 'three/src/renderers/shaders/UniformsLib.js' | |
export { UniformsUtils } from 'three/src/renderers/shaders/UniformsUtils.js' | |
export { ShaderChunk } from 'three/src/renderers/shaders/ShaderChunk.js' | |
export { Scene } from 'three/src/scenes/Scene.js' | |
export { Mesh } from 'three/src/objects/Mesh.js' | |
export { LineSegments } from 'three/src/objects/LineSegments.js' |
This file contains 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
import React from 'react' | |
import { StyleSheet, Text, View, TouchableWithoutFeedback } from 'react-native' | |
import { Spring, animated } from 'react-spring/dist/native' | |
const styles = { | |
flex: 1, | |
margin: 0, | |
borderRadius: 35, | |
backgroundColor: 'red', | |
alignItems: 'center', |
This file contains 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
"scripts": { | |
"dev": "node .dev/webpack.dev.server.js", | |
"dev-prod": "node .dev/webpack.dev.server.js --production", | |
"build": "rimraf ./dist && webpack --config .dev/webpack.config.production.js --colors", | |
}, | |
"devDependencies": { | |
"@babel/core": "7.0.0-beta.38", | |
"@babel/plugin-proposal-class-properties": "7.0.0-beta.38", | |
"@babel/plugin-proposal-decorators": "7.0.0-beta.38", | |
"@babel/plugin-transform-classes": "7.0.0-beta.38", |
This file contains 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
{ | |
"$schema": "vscode://schemas/color-theme", | |
"type": "dark", | |
"colors": { | |
"activityBar.activeBorder": "#a6accd", | |
"activityBar.background": "#1b1e28", | |
"activityBar.dropBorder": "#a6accd", | |
"activityBar.foreground": "#a6accd", | |
"activityBar.inactiveForeground": "#a6accd66", | |
"activityBarBadge.background": "#303340", |
This file contains 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
import * as THREE from "three" | |
// credits for the box-projecting shader code go to codercat (https://codercat.tk) | |
const worldposReplace = /* glsl */` | |
#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) | |
vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 ); | |
#ifdef BOX_PROJECTED_ENV_MAP | |
vWorldPosition = worldPosition.xyz; |
NewerOlder