feat: some stuff
Some checks failed
Deploy to GitHub Pages / build (push) Failing after 14m41s
Deploy to GitHub Pages / deploy (push) Has been skipped

This commit is contained in:
2024-04-03 21:09:50 +02:00
parent d025f7e01b
commit 1e04a7be6f
46 changed files with 241 additions and 48 deletions

View File

@@ -3,7 +3,6 @@ import { rand, randMinMax } from "./random";
import fragment from "./Leaf.frag";
import vertex from "./Leaf.vert";
import { rgbToHex } from '@helpers/colors';
let rotation = 0;
@@ -11,14 +10,12 @@ export function setRotation(r: number) {
rotation = r;
}
export function createLeaves({ canvas, num = 20, alpha = false, minZ = -1, maxZ = 1 }: { canvas: HTMLCanvasElement, num?: number, alpha?: boolean, minZ?: number, maxZ?: number }) {
export function createLeaves({ canvas, num = 20, color, minZ = -1, maxZ = 1 }: { canvas: HTMLCanvasElement, num?: number, color?: Color, minZ?: number, maxZ?: number }) {
const renderer = new Renderer({ dpr: 1, canvas, alpha: true });
const gl = renderer.gl;
const background = window.getComputedStyle(document.body);
const d = new Color(rgbToHex(background.backgroundColor));
const camera = new Camera(gl, { fov: 15 });
camera.position.z = 5;
@@ -40,7 +37,7 @@ export function createLeaves({ canvas, num = 20, alpha = false, minZ = -1, maxZ
uniforms: {
uTime: { value: 0 },
uRot: { value: 0 },
uBackground: { value: d },
uBackground: { value: color },
},
});