artemnovitckii/claude-animation-skills / skills/zach-d-films
zach-d-films
VerifiedMakes a 3D cartoon "what if" explainer short (9:16) in the style of Zack D. Films-type videos, entirely in code with three.js. Procedural cartoon people, props and effects, a blue studio sky, slow-motion impacts, a red force-ripple overlay, quick whip cuts and 1 to 3 word captions timed to the voiceover. Use when the user runs /zach-d-films or asks for a 3D cartoon explainer, a "could X stop Y" or "what if" short with characters and props.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.9 KB |
| engine/captions.pyexecutable | script | 1.4 KB |
| engine/index.html | other | 1.2 KB |
| engine/render.mjs | script | 2.9 KB |
| engine/src/anim.js | script | 3.2 KB |
| engine/src/human.js | script | 18.5 KB |
| engine/src/main.js | script | 7.7 KB |
| engine/src/materials.js | script | 3.0 KB |
| engine/src/props.js | script | 14.1 KB |
| engine/src/shots.js | script | 23.9 KB |
| engine/src/textures.js | script | 5.4 KB |
engine/src/main.js
View on GitHubimport * as THREE from 'three';
import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
import { BokehPass } from 'three/addons/postprocessing/BokehPass.js';
import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';
import { OutputPass } from 'three/addons/postprocessing/OutputPass.js';
import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
import { SHOTS, CAPTIONS, DURATION, FADES } from './shots.js';
const W = 720, H = 1280;
const renderer = new THREE.WebGLRenderer({ antialias: false, preserveDrawingBuffer: true, powerPreference: 'high-performance' });
renderer.setPixelRatio(1);
renderer.setSize(W, H);
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.toneMappingExposure = 1.0;
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.PCFSoftShadowMap;
document.getElementById('stage').prepend(renderer.domElement);
// ---------- shared environment (reflections for the metal) ----------
const SKY_FRAG = `
uniform vec3 top, mid, horizon, floorC; varying vec3 vDir;
void main(){
vec3 d = normalize(vDir);
float y = d.y;
vec3 c = y > 0.0 ? mix(mix(horizon, mid, smoothstep(0.0,0.12,y)), top, smoothstep(0.1,0.8,y))
: mix(horizon, floorC, smoothstep(0.0,-0.08,y));
gl_FragColor = vec4(c,1.0);
#include <colorspace_fragment>
}`;
export function skyMaterial() {
return new THREE.ShaderMaterial({
uniforms: {
top: { value: new THREE.Color(0x2b78d6) }, mid: { value: new THREE.Color(0x5b9fea) },
horizon: { value: new THREE.Color(0x92c3f2) }, floorC: { value: new THREE.Color(0xa9cdf1) },
},
vertexShader: `varying vec3 vDir; void main(){ vDir = (modelMatrix*vec4(position,1.)).xyz - cameraPosition; gl_Position = projectionMatrix*modelViewMatrix*vec4(position,1.); gl_Position.z = gl_Position.w; }`,
fragmentShader: SKY_FRAG, side: THREE.BackSide, depthWrite: false, toneMapped: false,
});
}
const pmrem = new THREE.PMREMGenerator(renderer);
const envScene = new THREE.Scene();
{
const s = new THREE.Mesh(new THREE.SphereGeometry(20, 64, 32), skyMaterial());
s.material.toneMapped = true; envScene.add(s);
const u = s.material.uniforms;
u.top.value.set(0x9aa6b6); u.mid.value.set(0xb7c2cf); u.horizon.value.set(0xe2e6ea); u.floorC.value.set(0x5c6066);
const panel = (w, h, pos, inten) => {
const m = new THREE.Mesh(new THREE.PlaneGeometry(w, h), new THREE.MeshBasicMaterial({ color: new THREE.Color(inten, inten, inten), side: THREE.DoubleSide }));
m.position.set(...pos); m.lookAt(0, 0, 0); envScene.add(m);
};
panel(8, 4, [-6, 8, 6], 3.2); // key softbox
panel(4, 10, [9, 3, -2], 1.6); // rim strip
panel(10, 3, [0, 4, -9], 1.0);
const fl = new THREE.Mesh(new THREE.PlaneGeometry(60, 60), new THREE.MeshBasicMaterial({ color: 0x7d8fa6 }));
fl.rotation.x = -Math.PI / 2; fl.position.y = -1.2; fl.material.color.set(0x55595f); envScene.add(fl);
}
const envTex = pmrem.fromScene(envScene, 0.02).texture;
export function makeStage({ shadowSize = 3, sunDir = [-3, 6, 4], sun = 2.3 } = {}) {
const scene = new THREE.Scene();
scene.environment = envTex;
scene.environmentIntensity = 1.0;
const sky = new THREE.Mesh(new THREE.SphereGeometry(80, 48, 24), skyMaterial());
sky.frustumCulled = false; sky.renderOrder = -10;
scene.add(sky); scene.userData.sky = sky;
const ground = new THREE.Mesh(new THREE.PlaneGeometry(60, 60), new THREE.ShadowMaterial({ color: 0x1a3a66, opacity: 0.32 }));
ground.rotation.x = -Math.PI / 2; ground.receiveShadow = true; scene.add(ground);
const hemi = new THREE.HemisphereLight(0xcfe4ff, 0x7f93ad, 0.75); scene.add(hemi);
const key = new THREE.DirectionalLight(0xfff3e6, sun);
key.position.set(...sunDir); key.castShadow = true;
key.shadow.mapSize.set(1536, 1536);
const c = key.shadow.camera; c.left = c.bottom = -shadowSize; c.right = c.top = shadowSize; c.near = 0.5; c.far = 30;
key.shadow.bias = -0.0004; key.shadow.normalBias = 0.02; key.shadow.radius = 4;
scene.add(key, key.target);
const rim = new THREE.DirectionalLight(0xdbe9ff, 1.2); rim.position.set(4, 3, -5); scene.add(rim);
scene.userData.key = key;
return scene;
}
// ---------- post ----------
const rt = new THREE.WebGLRenderTarget(W, H, { samples: 4, type: THREE.HalfFloatType });
const composer = new EffectComposer(renderer, rt);
const dummyScene = new THREE.Scene(), dummyCam = new THREE.PerspectiveCamera();
const renderPass = new RenderPass(dummyScene, dummyCam);
const bokeh = new BokehPass(dummyScene, dummyCam, { focus: 2, aperture: 0.002, maxblur: 0.01 });
const bloom = new UnrealBloomPass(new THREE.Vector2(W, H), 0.25, 0.4, 1.6);
const grade = new ShaderPass({
uniforms: { tDiffuse: { value: null }, uTime: { value: 0 }, uVig: { value: 0.28 } },
vertexShader: `varying vec2 vUv; void main(){ vUv=uv; gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.); }`,
fragmentShader: `uniform sampler2D tDiffuse; uniform float uTime, uVig; varying vec2 vUv;
float h(vec2 p){ return fract(sin(dot(p, vec2(12.9898,78.233)) + uTime*7.13) * 43758.5453); }
void main(){ vec4 c = texture2D(tDiffuse, vUv);
vec2 q = vUv - 0.5; q.x *= 0.5625;
c.rgb *= 1.0 - uVig * smoothstep(0.18, 0.62, length(q));
c.rgb += (h(vUv*1280.0) - 0.5) * 0.018;
gl_FragColor = c; }`,
});
composer.addPass(renderPass);
composer.addPass(bokeh);
composer.addPass(bloom);
composer.addPass(new OutputPass());
composer.addPass(grade);
// ---------- timeline ----------
const capEl = document.getElementById('cap');
const fadeEl = document.getElementById('fade');
const hud = document.getElementById('hud');
const built = new Map();
function getShot(i) {
if (!built.has(i)) built.set(i, SHOTS[i].build({ makeStage, W, H }));
return built.get(i);
}
window.DURATION = DURATION;
window.renderAt = (t) => {
let idx = SHOTS.findIndex(s => t >= s.start && t < s.end);
if (idx < 0) idx = SHOTS.length - 1;
const def = SHOTS[idx];
const shot = getShot(idx);
const lt = t - def.start;
const r = shot.update(lt, t) || {};
const cam = shot.camera;
cam.aspect = W / H; cam.updateProjectionMatrix();
shot.scene.userData.sky.position.copy(cam.position);
renderPass.scene = bokeh.scene = shot.scene;
renderPass.camera = bokeh.camera = cam;
const dof = r.dof || { focus: 3, aperture: 0, maxblur: 0 };
bokeh.enabled = dof.aperture > 0;
bokeh.uniforms.focus.value = dof.focus;
bokeh.uniforms.aperture.value = dof.aperture;
bokeh.uniforms.maxblur.value = dof.maxblur ?? 0.012;
bokeh.uniforms.nearClip.value = cam.near; bokeh.uniforms.farClip.value = cam.far;
bloom.strength = (r.bloom ?? 0.35) * 0.6;
renderer.toneMappingExposure = r.exposure ?? 1.0;
grade.uniforms.uTime.value = t;
composer.render();
// captions + fades
const c = CAPTIONS.filter(c => t >= c[0]).pop();
capEl.textContent = c && (c[2] == null || t < c[2]) ? c[1] : '';
let f = 0;
for (const [a, b, c2, d] of FADES) if (t >= a && t < d) f = Math.max(f, t < b ? (t - a) / (b - a) : t < c2 ? 1 : (d - t) / (d - c2));
fadeEl.style.opacity = f;
hud.textContent = `t=${t.toFixed(2)} shot ${idx}`;
return idx;
};
// interactive preview: ?t=12.3 for a still, otherwise realtime playback
const qs = new URLSearchParams(location.search);
window.ready = document.fonts.ready.then(() => true);
if (qs.has('t')) window.ready.then(() => window.renderAt(parseFloat(qs.get('t'))));
else if (!qs.has('render')) {
const audio = new Audio('./audio.m4a');
let t0 = null;
document.body.addEventListener('click', () => { audio.currentTime = 0; audio.play(); t0 = performance.now(); });
const loop = () => { const t = t0 ? ((performance.now() - t0) / 1000) % DURATION : 0; window.renderAt(t); requestAnimationFrame(loop); };
window.ready.then(loop);
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |