Skip to content

Instantly share code, notes, and snippets.

View seantai's full-sized avatar

sean tai seantai

View GitHub Profile
@seantai
seantai / lorenz.py
Created October 21, 2022 08:18
Lorenz Attractor in Blender
# as explained by QuantitativeBytes
# https://youtu.be/iDHWyt1v4T8
import bpy
class Lorenz:
def __init__(self, sceneRef, objName, color, initX, initY, initZ):
self.X, self.Y, self.Z = initX, initY, initZ
self.dt = 0.005
self.a, self.b, self.c = 10, 28, 8/3
@seantai
seantai / zustandR3F.jsx
Created March 8, 2024 00:11
update zustand state in useFrame
import { useFrame } from '@react-three/fiber'
import React, { useEffect, useRef } from 'react'
import { create } from 'zustand'
function AnimateBoxWithZustand() {
const useStore = create((set) => ({
position: [0, 0, 0],
setPosition: (newPosition) => set(() => ({ position: newPosition })),
updatePosition: (time) =>
set((state) => ({
const uniforms = useRef(null)
useFrame(({ clock }) => {
if (!uniforms.current) return
uniforms.current.u_color.value.y = Math.sin(clock.elapsedTime * 2)
})
return (
<mesh geometry={Suz.nodes.geometry}>
<meshNormalMaterial
@seantai
seantai / Border.tsx
Last active September 22, 2024 13:09
border for View
import { Plane } from '@react-three/drei';
import { useMemo } from 'react';
export const Border = () => {
const uniforms = useMemo(
() => ({
u_color: {
value: [0.129, 0.129, 0.129] //same color as my background
},
u_outline_color: {
@seantai
seantai / LiquidRainbow.tsx
Last active March 24, 2025 21:53
LiquidRainbow.tsx
import { useFBO } from '@react-three/drei';
import { useFrame, useThree, type ThreeEvent } from '@react-three/fiber';
import { useCallback, useEffect, useMemo, useRef } from 'react';
import * as THREE from 'three';
export const LiquifyShader = () => {
const gl = useThree((s) => s.gl);
const size = useThree((s) => s.size);
const viewport = useThree((s) => s.viewport);
const mesh = useRef<THREE.Mesh>(null);