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
function lerp(start, end, t) { | |
return start * (1 - t) + end * t; | |
} |
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 { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'; | |
let camera, scene, renderer; | |
init(); | |
animate(); | |
function init() { | |
camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); |
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
precision mediump float; | |
varying vec2 vUv; | |
void main() { | |
gl_Position = vec4(vUv, 0., 1.); | |
} |
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
vec3 palette(in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d) { | |
return a + b * cos(6.28318 * (c * t + d)); | |
} |
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
const int AMOUNT = 25; | |
void main () { | |
float TIME = uTime * 1.0; | |
vec2 uv = scale * (gl_FragCoord.xy - .5 * uResolution.xy) / uResolution.y; | |
// uv *= rotate(uv, angle1); | |
uv.x *= 0.85; | |
uv.y += 10.; |
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
vec2 backgroundCoverUv(vec2 screenSize, vec2 imageSize, vec2 uv) { | |
float screenRatio = screenSize.x / screenSize.y; | |
float imageRatio = imageSize.x / imageSize.y; | |
vec2 newSize = screenRatio < imageRatio | |
? vec2(imageSize.x * screenSize.y / imageSize.y, screenSize.y) | |
: vec2(screenSize.x, imageSize.y * screenSize.x / imageSize.x); | |
vec2 newOffset = (screenRatio < imageRatio | |
? vec2((newSize.x - screenSize.x) / 2.0, 0.0) |
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
#define PI 3.1415926538 | |
#define TWO_PI 6.28318530718 | |
vec2 scaleFromCenter = (uv - 0.5) + 0.5; | |
mat2 scale(vec2 scale){ | |
return mat2(scale.x, 0.0, | |
0.0, scale.y); | |
} |
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
mat2 rotation2d(float angle) { | |
float s = sin(angle); | |
float c = cos(angle); | |
return mat2( | |
c, -s, | |
s, c | |
); | |
} |
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 { Renderer, Camera, Transform, Orbit } from 'ogl'; | |
import store from '../store'; | |
import { Events } from '../events'; | |
import * as dat from 'dat.gui'; | |
export default new class { | |
constructor() { | |
this.renderer = new Renderer({ |
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 { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'; | |
import { Events } from '../events'; | |
import store from '../store'; | |
export default new class { | |
constructor() { | |
this.renderer = new THREE.WebGLRenderer({ | |
antialias: true, |
OlderNewer