Getting there
This commit is contained in:
parent
ed5a4379db
commit
f300dbd394
43 changed files with 1213 additions and 459 deletions
|
|
@ -138,6 +138,22 @@ test('shows a clear fallback when WebGPU is unavailable', async ({ page }) => {
|
|||
expect(browserFailures).toEqual([]);
|
||||
});
|
||||
|
||||
test('syncs the selected vibe with the URI', async ({ page }) => {
|
||||
const browserFailures = collectLocalBrowserFailures(page);
|
||||
|
||||
await disableWebGpu(page);
|
||||
await page.goto('/?vibe=Bone%20Archive');
|
||||
|
||||
await expect(page).toHaveURL(/vibe=bone-archive/);
|
||||
|
||||
await page.locator('.next-vibe').click();
|
||||
await expect(page).toHaveURL(/vibe=pelagic-caustics/);
|
||||
|
||||
await page.goBack();
|
||||
await expect(page).toHaveURL(/vibe=bone-archive/);
|
||||
expect(browserFailures).toEqual([]);
|
||||
});
|
||||
|
||||
test('keeps audio focus outlines scoped to the active control', async ({ page }) => {
|
||||
await disableWebGpu(page);
|
||||
await page.goto('/');
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
"@eslint/js": "^10.0.1",
|
||||
"@ianvs/prettier-plugin-sort-imports": "^4.7.1",
|
||||
"@playwright/test": "^1.60.0",
|
||||
"@tweakpane/core": "^2.0.5",
|
||||
"@tweakpane/core": "~2.0.5",
|
||||
"@types/node": "^25.6.0",
|
||||
"@vite-pwa/assets-generator": "^1.0.2",
|
||||
"@vitejs/plugin-basic-ssl": "^2.3.0",
|
||||
|
|
@ -71,6 +71,6 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@plausible-analytics/tracker": "^0.4.5",
|
||||
"tweakpane": "^4.0.5"
|
||||
"tweakpane": "~4.0.5"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 301 KiB |
|
|
@ -1,9 +1,11 @@
|
|||
import { DEFAULT_AUDIO_VOLUME } from '../consts';
|
||||
import type { PianoNoteRole } from './garden-audio-types';
|
||||
|
||||
type GardenAudioChordQuality = 'major' | 'minor' | 'sus2' | 'sus4';
|
||||
|
||||
export interface GardenAudioChord {
|
||||
rootOffset: number;
|
||||
quality: 'major' | 'minor';
|
||||
quality: GardenAudioChordQuality;
|
||||
}
|
||||
|
||||
export interface GardenAudioVibeSettings {
|
||||
|
|
@ -14,6 +16,8 @@ export interface GardenAudioVibeSettings {
|
|||
noteLength: number;
|
||||
notePitchOffset: number;
|
||||
brightness: number;
|
||||
scale?: Array<number>;
|
||||
progression?: Array<GardenAudioChord>;
|
||||
}
|
||||
|
||||
export interface GardenAudioVibeProfile extends GardenAudioVibeSettings {
|
||||
|
|
@ -37,7 +41,9 @@ export const createGardenAudioConfig = () => ({
|
|||
fadeInSeconds: 0.45,
|
||||
updateRampSeconds: 0.08,
|
||||
delay: {
|
||||
timeSeconds: 0.405,
|
||||
timeBeats: 0.5,
|
||||
timeMinSeconds: 0.18,
|
||||
timeMaxSeconds: 0.72,
|
||||
feedback: 0.12,
|
||||
wetGain: 0.044,
|
||||
erasingActivity: 0.12,
|
||||
|
|
|
|||
|
|
@ -121,19 +121,19 @@ export class GardenAudioGraph {
|
|||
);
|
||||
}
|
||||
|
||||
public applyDelayProfile(): void {
|
||||
public applyDelayProfile(bpm: number): void {
|
||||
if (!this.context || !this.delayNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.delayNode.delayTime.setTargetAtTime(
|
||||
this.config.delay.timeSeconds,
|
||||
this.getDelayTimeSecondsForBpm(bpm),
|
||||
this.context.currentTime,
|
||||
this.config.delay.timeRampSeconds
|
||||
);
|
||||
}
|
||||
|
||||
public updateDelay(activity: number): void {
|
||||
public updateDelay(activity: number, bpm: number): void {
|
||||
if (!this.context || !this.delayNode || !this.delayFeedback || !this.delayOutput) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ export class GardenAudioGraph {
|
|||
const now = this.context.currentTime;
|
||||
const normalizedActivity = clamp(activity, 0, 1);
|
||||
this.delayNode.delayTime.setTargetAtTime(
|
||||
this.config.delay.timeSeconds,
|
||||
this.getDelayTimeSecondsForBpm(bpm),
|
||||
now,
|
||||
this.config.delay.timeRampSeconds
|
||||
);
|
||||
|
|
@ -214,7 +214,7 @@ export class GardenAudioGraph {
|
|||
const feedbackLowPass = context.createBiquadFilter();
|
||||
const returnLowPass = context.createBiquadFilter();
|
||||
|
||||
delayNode.delayTime.value = this.config.delay.timeSeconds;
|
||||
delayNode.delayTime.value = this.getDelayTimeSecondsForBpm(this.config.rhythm.bpm);
|
||||
delayFeedback.gain.value = this.config.delay.feedback;
|
||||
delayOutput.gain.value = this.config.delay.wetGain;
|
||||
feedbackHighPass.type = 'highpass';
|
||||
|
|
@ -283,6 +283,15 @@ export class GardenAudioGraph {
|
|||
});
|
||||
}
|
||||
|
||||
private getDelayTimeSecondsForBpm(bpm: number): number {
|
||||
const safeBpm = Number.isFinite(bpm) ? Math.max(1, bpm) : this.config.rhythm.bpm;
|
||||
return clamp(
|
||||
(60 / safeBpm) * this.config.delay.timeBeats,
|
||||
this.config.delay.timeMinSeconds,
|
||||
this.config.delay.timeMaxSeconds
|
||||
);
|
||||
}
|
||||
|
||||
private createNoiseBuffer(context: AudioContext): AudioBuffer {
|
||||
const buffer = context.createBuffer(
|
||||
1,
|
||||
|
|
|
|||
|
|
@ -15,14 +15,24 @@ const DEFAULT_SCALE: ReadonlyArray<number> = [0, 2, 4, 7, 9];
|
|||
|
||||
const profileCache = new WeakMap<VibePreset, GardenAudioVibeProfile>();
|
||||
|
||||
const getProfileScale = (vibe: VibePreset): Array<number> => {
|
||||
const scale = vibe.audio.scale?.length ? vibe.audio.scale : DEFAULT_SCALE;
|
||||
return [...scale];
|
||||
};
|
||||
|
||||
const getProfileProgression = (vibe: VibePreset): Array<GardenAudioChord> =>
|
||||
(vibe.audio.progression?.length ? vibe.audio.progression : DEFAULT_PROGRESSION).map(
|
||||
(chord) => ({ ...chord })
|
||||
);
|
||||
|
||||
export const getVibeProfile = (vibe: VibePreset): GardenAudioVibeProfile => {
|
||||
let profile = profileCache.get(vibe);
|
||||
if (!profile) {
|
||||
profile = {
|
||||
...vibe.audio,
|
||||
rootMidi: DEFAULT_ROOT_MIDI + vibe.audio.notePitchOffset,
|
||||
scale: DEFAULT_SCALE as Array<number>,
|
||||
progression: DEFAULT_PROGRESSION as Array<GardenAudioChord>,
|
||||
scale: getProfileScale(vibe),
|
||||
progression: getProfileProgression(vibe),
|
||||
};
|
||||
profileCache.set(vibe, profile);
|
||||
return profile;
|
||||
|
|
@ -30,5 +40,7 @@ export const getVibeProfile = (vibe: VibePreset): GardenAudioVibeProfile => {
|
|||
|
||||
Object.assign(profile, vibe.audio);
|
||||
profile.rootMidi = DEFAULT_ROOT_MIDI + vibe.audio.notePitchOffset;
|
||||
profile.scale = getProfileScale(vibe);
|
||||
profile.progression = getProfileProgression(vibe);
|
||||
return profile;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { ErrorHandler, Severity } from '../utils/error-handler';
|
||||
import { clamp01 } from '../utils/math';
|
||||
import type { VibeId, VibePreset } from '../vibes';
|
||||
import type { GardenAudioConfig } from './garden-audio-config';
|
||||
import type { GardenAudioConfig, GardenAudioVibeProfile } from './garden-audio-config';
|
||||
import { GardenAudioEnergy } from './garden-audio-energy';
|
||||
import { GardenAudioGestureState } from './garden-audio-gesture-state';
|
||||
import { GardenAudioGraph } from './garden-audio-graph';
|
||||
|
|
@ -155,11 +155,12 @@ export class GardenAudio {
|
|||
): void {
|
||||
this.lifecycle = 'started';
|
||||
this.currentVibeId = vibe.id;
|
||||
this.graph.applyDelayProfile();
|
||||
const profile = getVibeProfile(vibe);
|
||||
this.graph.applyDelayProfile(profile.bpm);
|
||||
this.graph.setMasterGain(this.masterVolume, startupRampSeconds);
|
||||
|
||||
if (cuePiano) {
|
||||
this.pianoEngine.cue(context.currentTime, getVibeProfile(vibe));
|
||||
this.pianoEngine.cue(context.currentTime, profile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -245,7 +246,7 @@ export class GardenAudio {
|
|||
|
||||
if (!this.isGestureActive && this.isReleasingPiano) {
|
||||
this.updatePianoRelease(snapshot.vibe, context.currentTime);
|
||||
this.updateDelay(snapshot);
|
||||
this.updateDelay(snapshot, profile);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +257,7 @@ export class GardenAudio {
|
|||
? this.config.eraser.pianoActivity
|
||||
: this.energy.getLevel(),
|
||||
});
|
||||
this.updateDelay(snapshot);
|
||||
this.updateDelay(snapshot, profile);
|
||||
}
|
||||
|
||||
public stroke(stroke: GardenAudioStroke): void {
|
||||
|
|
@ -371,7 +372,10 @@ export class GardenAudio {
|
|||
}
|
||||
}
|
||||
|
||||
private updateDelay(snapshot: GardenAudioSnapshot): void {
|
||||
private updateDelay(
|
||||
snapshot: GardenAudioSnapshot,
|
||||
profile: GardenAudioVibeProfile
|
||||
): void {
|
||||
const context = this.graph.context;
|
||||
if (!context) {
|
||||
return;
|
||||
|
|
@ -380,7 +384,7 @@ export class GardenAudio {
|
|||
const activity = snapshot.isErasing
|
||||
? this.config.delay.erasingActivity
|
||||
: this.energy.getLevel();
|
||||
this.graph.updateDelay(activity);
|
||||
this.graph.updateDelay(activity, profile.bpm);
|
||||
}
|
||||
|
||||
private applyVibe(vibe: VibePreset): void {
|
||||
|
|
@ -390,7 +394,7 @@ export class GardenAudio {
|
|||
|
||||
this.currentVibeId = vibe.id;
|
||||
const profile = getVibeProfile(vibe);
|
||||
this.graph.applyDelayProfile();
|
||||
this.graph.applyDelayProfile(profile.bpm);
|
||||
this.pianoEngine.cue(this.graph.context.currentTime, profile);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,6 +152,12 @@ interface GenerativePianoTuning {
|
|||
min: number;
|
||||
max: number;
|
||||
};
|
||||
stereoWidth: {
|
||||
idle: number;
|
||||
active: number;
|
||||
intense: number;
|
||||
intenseThreshold: number;
|
||||
};
|
||||
stylePanOffsetScale: number;
|
||||
lowpass: {
|
||||
midiBase: number;
|
||||
|
|
@ -371,6 +377,12 @@ export const generativePianoTuning: GenerativePianoTuning = {
|
|||
min: -3,
|
||||
max: 3,
|
||||
},
|
||||
stereoWidth: {
|
||||
idle: 0.46,
|
||||
active: 0.9,
|
||||
intense: 1.16,
|
||||
intenseThreshold: 0.72,
|
||||
},
|
||||
stylePanOffsetScale: 0.35,
|
||||
lowpass: {
|
||||
midiBase: 48,
|
||||
|
|
|
|||
|
|
@ -18,23 +18,34 @@ import { PIANO_SCHEDULE_AHEAD_SECONDS } from './piano-sampler';
|
|||
const GENERATIVE_LOOKAHEAD_SECONDS = 0.3;
|
||||
const GENERATIVE_START_DELAY_SECONDS = 0.02;
|
||||
|
||||
const chordVoicings = {
|
||||
majorOpen: [0, 7, 12, 16],
|
||||
minorOpen: [0, 7, 12, 15],
|
||||
majorClosed: [0, 4, 7, 12, 16],
|
||||
minorClosed: [0, 3, 7, 12, 15],
|
||||
const chordVoicings: Record<
|
||||
GardenAudioChord['quality'],
|
||||
{ closed: Array<number>; open: Array<number> }
|
||||
> = {
|
||||
major: {
|
||||
closed: [0, 4, 7, 12, 16],
|
||||
open: [0, 7, 12, 16],
|
||||
},
|
||||
minor: {
|
||||
closed: [0, 3, 7, 12, 15],
|
||||
open: [0, 7, 12, 15],
|
||||
},
|
||||
sus2: {
|
||||
closed: [0, 2, 7, 12, 14],
|
||||
open: [0, 7, 12, 14],
|
||||
},
|
||||
sus4: {
|
||||
closed: [0, 5, 7, 12, 17],
|
||||
open: [0, 7, 12, 17],
|
||||
},
|
||||
};
|
||||
|
||||
const getChordIntervals = (
|
||||
chord: GardenAudioChord,
|
||||
openVoicing: boolean
|
||||
): Array<number> => {
|
||||
if (openVoicing) {
|
||||
return chord.quality === 'major' ? chordVoicings.majorOpen : chordVoicings.minorOpen;
|
||||
}
|
||||
return chord.quality === 'major'
|
||||
? chordVoicings.majorClosed
|
||||
: chordVoicings.minorClosed;
|
||||
const voicing = chordVoicings[chord.quality];
|
||||
return openVoicing ? voicing.open : voicing.closed;
|
||||
};
|
||||
|
||||
const degreeToSemitone = (profile: GardenAudioVibeProfile, degree: number): number => {
|
||||
|
|
@ -406,7 +417,7 @@ export class GenerativePianoEngine {
|
|||
velocity + expression * generativePianoTuning.padChord.expressionVelocityWeight,
|
||||
startTime,
|
||||
durationSeconds,
|
||||
pan: register.pan,
|
||||
pan: this.getActivityPan(register.pan, expression),
|
||||
role: 'pad',
|
||||
delaySend: generativePianoTuning.padChord.delaySend,
|
||||
lowpassHz: this.getLowpassHz(
|
||||
|
|
@ -446,7 +457,7 @@ export class GenerativePianoEngine {
|
|||
velocity: release.velocities[index],
|
||||
startTime: startTime + index * release.strumSeconds,
|
||||
durationSeconds: release.durationSeconds,
|
||||
pan: register.pan,
|
||||
pan: this.getActivityPan(register.pan, 0),
|
||||
role: 'pad',
|
||||
delaySend: release.delaySend,
|
||||
lowpassHz: this.getLowpassHz(profile, midi, release.lowpassExpression),
|
||||
|
|
@ -487,7 +498,7 @@ export class GenerativePianoEngine {
|
|||
durationSeconds:
|
||||
generativePianoTuning.supportNote.durationBaseSeconds +
|
||||
expression * generativePianoTuning.supportNote.durationExpressionSeconds,
|
||||
pan: this.getStylePan(styleIndex),
|
||||
pan: this.getStylePan(styleIndex, expression),
|
||||
role: 'support',
|
||||
delaySend:
|
||||
generativePianoTuning.supportNote.delaySendBase +
|
||||
|
|
@ -533,7 +544,7 @@ export class GenerativePianoEngine {
|
|||
durationSeconds:
|
||||
generativePianoTuning.textureNote.durationBaseSeconds +
|
||||
expression * generativePianoTuning.textureNote.durationExpressionSeconds,
|
||||
pan: this.getStylePan(styleIndex),
|
||||
pan: this.getStylePan(styleIndex, expression),
|
||||
role: 'texture',
|
||||
delaySend:
|
||||
generativePianoTuning.textureNote.delaySendBase +
|
||||
|
|
@ -582,7 +593,7 @@ export class GenerativePianoEngine {
|
|||
durationSeconds:
|
||||
generativePianoTuning.gestureAccent.durationBaseSeconds +
|
||||
strength * generativePianoTuning.gestureAccent.durationStrengthSeconds,
|
||||
pan: this.getStylePan(styleIndex),
|
||||
pan: this.getStylePan(styleIndex, strength),
|
||||
role: 'gesture',
|
||||
delaySend: generativePianoTuning.gestureAccent.delaySend,
|
||||
lowpassHz: this.getLowpassHz(profile, midi, strength),
|
||||
|
|
@ -627,7 +638,7 @@ export class GenerativePianoEngine {
|
|||
durationSeconds:
|
||||
generativePianoTuning.touchNote.durationBaseSeconds +
|
||||
strength * generativePianoTuning.touchNote.durationStrengthSeconds,
|
||||
pan: this.getStylePan(styleIndex),
|
||||
pan: this.getStylePan(styleIndex, strength),
|
||||
role: 'gesture',
|
||||
delaySend: generativePianoTuning.touchNote.delaySend,
|
||||
lowpassHz: this.getLowpassHz(
|
||||
|
|
@ -813,7 +824,7 @@ export class GenerativePianoEngine {
|
|||
chordOffsets: this.getChordOffsets(chord, chordIntervals),
|
||||
};
|
||||
const midi = this.chooseMidi(source, register, this.lastBrushStreamMidi, true);
|
||||
const pan = this.getStylePan(styleIndex);
|
||||
const pan = this.getStylePan(styleIndex, intensity);
|
||||
const durationSeconds = clamp(
|
||||
generativePianoTuning.brushStream.durationBaseSeconds +
|
||||
intensity * generativePianoTuning.brushStream.durationIntensitySeconds -
|
||||
|
|
@ -1128,16 +1139,29 @@ export class GenerativePianoEngine {
|
|||
styleCount) as GardenAudioStyleIndex;
|
||||
}
|
||||
|
||||
private getStylePan(styleIndex: GardenAudioStyleIndex): number {
|
||||
private getStylePan(styleIndex: GardenAudioStyleIndex, activity: number): number {
|
||||
const pool = generativePianoTuning.stylePools[styleIndex];
|
||||
const styleVoice = styleVoices[styleIndex];
|
||||
return clamp(
|
||||
return this.getActivityPan(
|
||||
pool.pan + styleVoice.panOffset * generativePianoTuning.stylePanOffsetScale,
|
||||
-1,
|
||||
1
|
||||
activity
|
||||
);
|
||||
}
|
||||
|
||||
private getActivityPan(pan: number, activity: number): number {
|
||||
const { active, idle, intense, intenseThreshold } = generativePianoTuning.stereoWidth;
|
||||
const normalizedActivity = clamp01(activity);
|
||||
const safeThreshold = clamp(intenseThreshold, 0.001, 0.999);
|
||||
const width =
|
||||
normalizedActivity < safeThreshold
|
||||
? idle + ((active - idle) * normalizedActivity) / safeThreshold
|
||||
: active +
|
||||
((intense - active) * (normalizedActivity - safeThreshold)) /
|
||||
(1 - safeThreshold);
|
||||
|
||||
return clamp(pan * width, -1, 1);
|
||||
}
|
||||
|
||||
private getLowpassHz(
|
||||
profile: GardenAudioVibeProfile,
|
||||
midi: number,
|
||||
|
|
|
|||
|
|
@ -107,8 +107,7 @@ export const appConfig = {
|
|||
titleStrokeWidthRatio: 0.11,
|
||||
verticalAnchor: 0.47,
|
||||
},
|
||||
introMoveSpeedBaseMultiplier: 1.8,
|
||||
introMoveSpeedProgressMultiplier: 0.35,
|
||||
introMoveSpeed: 280,
|
||||
stroke: {
|
||||
densityMultiplier: 110,
|
||||
maxAgentCount: 2_400,
|
||||
|
|
@ -129,7 +128,7 @@ export const appConfig = {
|
|||
step: 1,
|
||||
},
|
||||
mirror: {
|
||||
default: 1,
|
||||
default: 8,
|
||||
fallbackSegmentName: 'slices',
|
||||
max: 12,
|
||||
min: 1,
|
||||
|
|
|
|||
27
src/config/brush-size.test.ts
Normal file
27
src/config/brush-size.test.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import {
|
||||
BRUSH_SIZE_BASELINE_RENDER_AREA_MEGAPIXELS,
|
||||
getBrushRenderQualityScale,
|
||||
getRenderQualityBrushSize,
|
||||
} from './brush-size';
|
||||
|
||||
describe('render-quality brush sizing', () => {
|
||||
it('keeps brush sizes unchanged at the 7.3 MP baseline', () => {
|
||||
expect(
|
||||
getRenderQualityBrushSize(21, BRUSH_SIZE_BASELINE_RENDER_AREA_MEGAPIXELS)
|
||||
).toBe(21);
|
||||
});
|
||||
|
||||
it('scales linear brush size with the square root of render area', () => {
|
||||
const doubledLinearQuality = BRUSH_SIZE_BASELINE_RENDER_AREA_MEGAPIXELS * 4;
|
||||
|
||||
expect(getBrushRenderQualityScale(doubledLinearQuality)).toBe(2);
|
||||
expect(getRenderQualityBrushSize(9.75, doubledLinearQuality)).toBe(19.5);
|
||||
});
|
||||
|
||||
it('falls back to baseline scaling for invalid render areas', () => {
|
||||
expect(getBrushRenderQualityScale(0)).toBe(1);
|
||||
expect(getRenderQualityBrushSize(6.5, Number.NaN)).toBe(6.5);
|
||||
});
|
||||
});
|
||||
19
src/config/brush-size.ts
Normal file
19
src/config/brush-size.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
export const BRUSH_SIZE_BASELINE_RENDER_AREA_MEGAPIXELS = 7.3;
|
||||
|
||||
const getSafeRenderAreaMegapixels = (renderAreaMegapixels: number): number =>
|
||||
Number.isFinite(renderAreaMegapixels) && renderAreaMegapixels > 0
|
||||
? renderAreaMegapixels
|
||||
: BRUSH_SIZE_BASELINE_RENDER_AREA_MEGAPIXELS;
|
||||
|
||||
export const getBrushRenderQualityScale = (renderAreaMegapixels: number): number =>
|
||||
Math.sqrt(
|
||||
getSafeRenderAreaMegapixels(renderAreaMegapixels) /
|
||||
BRUSH_SIZE_BASELINE_RENDER_AREA_MEGAPIXELS
|
||||
);
|
||||
|
||||
export const getRenderQualityBrushSize = (
|
||||
brushSize: number,
|
||||
renderAreaMegapixels: number
|
||||
): number =>
|
||||
Math.max(0, Number.isFinite(brushSize) ? brushSize : 0) *
|
||||
getBrushRenderQualityScale(renderAreaMegapixels);
|
||||
|
|
@ -1,17 +1,5 @@
|
|||
import type { NumberControlConfig } from './types';
|
||||
|
||||
export const colorInteractionSettings = {
|
||||
color1ToColor1: 1,
|
||||
color1ToColor2: 0,
|
||||
color1ToColor3: 0,
|
||||
color2ToColor1: 0,
|
||||
color2ToColor2: 1,
|
||||
color2ToColor3: 0,
|
||||
color3ToColor1: 0,
|
||||
color3ToColor2: 0,
|
||||
color3ToColor3: 1,
|
||||
};
|
||||
|
||||
export const colorInteractionControl = (label: string): NumberControlConfig => ({
|
||||
folder: 'Color Reactions',
|
||||
label,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import { colorInteractionSettings } from './color-interactions';
|
||||
import { runtimeControls } from './runtime-controls';
|
||||
import type { GardenAppConfig } from './types';
|
||||
|
||||
|
|
@ -27,12 +26,8 @@ const computeDefaultInternalRenderAreaMegapixels = (): number => {
|
|||
};
|
||||
|
||||
export const defaultSettings: GardenAppConfig['defaultSettings'] = {
|
||||
...colorInteractionSettings,
|
||||
selectedColorIndex: 0,
|
||||
|
||||
turnWhenLost: 0.8,
|
||||
forwardRotationScale: 0.25,
|
||||
sensorOffsetAngle: 32,
|
||||
introNearDistanceMin: 28,
|
||||
introNearDistanceInner: 4,
|
||||
introNearSensorOffsetMultiplier: 0.75,
|
||||
|
|
@ -40,8 +35,6 @@ export const defaultSettings: GardenAppConfig['defaultSettings'] = {
|
|||
introProgressCutoff: 0.999,
|
||||
introTurnRateMultiplier: 3.4,
|
||||
introRandomTurnMultiplier: 0.18,
|
||||
introFarMoveMultiplier: 2.65,
|
||||
introNearMoveMultiplier: 0.01,
|
||||
introStepStopDistance: 0.5,
|
||||
randomTimeScale: 0.34816,
|
||||
|
||||
|
|
@ -58,7 +51,6 @@ export const defaultSettings: GardenAppConfig['defaultSettings'] = {
|
|||
brushCurveMirrorResolutionExponent: 0.5,
|
||||
brushCurveSegmentBrushRadiusRatio: 0.65,
|
||||
brushSmoothingMinSampleDistance: 0.5,
|
||||
strokeAngleJitterRadians: Math.PI * 0.7,
|
||||
|
||||
brushAlpha: 1,
|
||||
brushDiscardThreshold: 0.02,
|
||||
|
|
@ -78,7 +70,7 @@ export const defaultSettings: GardenAppConfig['defaultSettings'] = {
|
|||
adaptiveCapInitial: 1_000_000,
|
||||
adaptiveCapMin: 50_000,
|
||||
internalRenderAreaMegapixels: computeDefaultInternalRenderAreaMegapixels(),
|
||||
maxAgentCount: 700_000,
|
||||
maxAgentCount: 1_500_000,
|
||||
|
||||
renderTraceNormalizationFloor: 1,
|
||||
renderBrushColorBase: 1.2,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,16 @@ import type { GardenAppConfig } from './types';
|
|||
const formatPercent = (value: number): string => `${Math.round(value * 100)}%`;
|
||||
const formatRadiansAsDegrees = (value: number): string =>
|
||||
`${Math.round((value * 180) / Math.PI)} deg`;
|
||||
const formatCompactNumber = (value: number): string => {
|
||||
if (value >= 1_000_000) {
|
||||
const millions = value / 1_000_000;
|
||||
return `${Number.isInteger(millions) ? millions : millions.toFixed(1)}M`;
|
||||
}
|
||||
if (value >= 1_000) {
|
||||
return `${Math.round(value / 1_000)}k`;
|
||||
}
|
||||
return `${value}`;
|
||||
};
|
||||
|
||||
export const runtimeControls: GardenAppConfig['runtimeSettings']['controls'] = {
|
||||
color1ToColor1: colorInteractionControl('Color 1 Follows Color 1'),
|
||||
|
|
@ -20,14 +30,14 @@ export const runtimeControls: GardenAppConfig['runtimeSettings']['controls'] = {
|
|||
folder: 'Brush',
|
||||
label: 'Brush Size',
|
||||
min: 1,
|
||||
max: 60,
|
||||
max: 36,
|
||||
step: 0.25,
|
||||
},
|
||||
spawnPerPixel: {
|
||||
folder: 'Brush',
|
||||
label: 'Density',
|
||||
min: 0.01,
|
||||
max: 1,
|
||||
max: 0.38,
|
||||
step: 0.001,
|
||||
},
|
||||
strokeAngleJitterRadians: {
|
||||
|
|
@ -35,7 +45,7 @@ export const runtimeControls: GardenAppConfig['runtimeSettings']['controls'] = {
|
|||
format: formatRadiansAsDegrees,
|
||||
label: 'Spawn Spread',
|
||||
min: 0,
|
||||
max: Math.PI * 2,
|
||||
max: Math.PI,
|
||||
step: 0.01,
|
||||
},
|
||||
sensorOffsetDistance: {
|
||||
|
|
@ -81,6 +91,13 @@ export const runtimeControls: GardenAppConfig['runtimeSettings']['controls'] = {
|
|||
max: 1,
|
||||
step: 0.001,
|
||||
},
|
||||
diffusionRateTrails: {
|
||||
folder: 'Movement',
|
||||
label: 'Diffusion Rate',
|
||||
min: 0.01,
|
||||
max: 1,
|
||||
step: 0.01,
|
||||
},
|
||||
decayRateTrails: {
|
||||
folder: 'Movement',
|
||||
label: 'Trail Fade',
|
||||
|
|
@ -106,6 +123,7 @@ export const runtimeControls: GardenAppConfig['runtimeSettings']['controls'] = {
|
|||
|
||||
maxAgentCount: {
|
||||
folder: 'Performance',
|
||||
format: formatCompactNumber,
|
||||
integer: true,
|
||||
label: 'Population Limit',
|
||||
min: 0,
|
||||
|
|
|
|||
|
|
@ -52,17 +52,30 @@ type RuntimeSettingControlConfig = Partial<
|
|||
Record<keyof GardenRuntimeSettings, NumberControlConfig>
|
||||
>;
|
||||
|
||||
type GardenVibeSettings = Pick<
|
||||
export type GardenVibeSettings = Pick<
|
||||
GardenRuntimeSettings,
|
||||
| 'backgroundGrainStrength'
|
||||
| 'brushSize'
|
||||
| 'clarity'
|
||||
| 'color1ToColor1'
|
||||
| 'color1ToColor2'
|
||||
| 'color1ToColor3'
|
||||
| 'color2ToColor1'
|
||||
| 'color2ToColor2'
|
||||
| 'color2ToColor3'
|
||||
| 'color3ToColor1'
|
||||
| 'color3ToColor2'
|
||||
| 'color3ToColor3'
|
||||
| 'decayRateTrails'
|
||||
| 'forwardRotationScale'
|
||||
| 'individualTrailWeight'
|
||||
| 'moveSpeed'
|
||||
| 'sensorOffsetAngle'
|
||||
| 'sensorOffsetDistance'
|
||||
| 'spawnPerPixel'
|
||||
| 'strokeAngleJitterRadians'
|
||||
| 'turnSpeed'
|
||||
| 'turnWhenLost'
|
||||
>;
|
||||
|
||||
type GardenDefaultSettings = Omit<
|
||||
|
|
@ -72,10 +85,8 @@ type GardenDefaultSettings = Omit<
|
|||
|
||||
export enum VibeId {
|
||||
AuroraMycelium = 'aurora-mycelium',
|
||||
EmberCircuit = 'ember-circuit',
|
||||
VelvetObservatory = 'velvet-observatory',
|
||||
LichenSignal = 'lichen-signal',
|
||||
UltravioletSiren = 'ultraviolet-siren',
|
||||
TidepoolLantern = 'tidepool-lantern',
|
||||
PaperLanternFog = 'paper-lantern-fog',
|
||||
ChromePollen = 'chrome-pollen',
|
||||
|
|
@ -179,8 +190,7 @@ export interface GardenAppConfig {
|
|||
titleStrokeWidthRatio: number;
|
||||
verticalAnchor: number;
|
||||
};
|
||||
introMoveSpeedBaseMultiplier: number;
|
||||
introMoveSpeedProgressMultiplier: number;
|
||||
introMoveSpeed: number;
|
||||
stroke: {
|
||||
densityMultiplier: number;
|
||||
maxAgentCount: number;
|
||||
|
|
|
|||
66
src/config/vibe-presets.test.ts
Normal file
66
src/config/vibe-presets.test.ts
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
import { vibePresets } from './vibe-presets';
|
||||
|
||||
const FINAL_VIBE_NAMES = [
|
||||
'Aurora Mycelium',
|
||||
'Velvet Observatory',
|
||||
'Lichen Signal',
|
||||
'Tidepool Lantern',
|
||||
'Paper Lantern Fog Copy',
|
||||
'Chrome Pollen',
|
||||
];
|
||||
|
||||
describe('vibePresets', () => {
|
||||
it('keeps the classic preset set distinct', () => {
|
||||
expect(vibePresets.map((preset) => preset.name)).toEqual(FINAL_VIBE_NAMES);
|
||||
|
||||
const ids = vibePresets.map((preset) => preset.id);
|
||||
expect(new Set(ids).size).toBe(vibePresets.length);
|
||||
});
|
||||
|
||||
it('includes both blended and visibly particulate styles', () => {
|
||||
const blendedNames = vibePresets
|
||||
.filter(
|
||||
(preset) => preset.settings.brushSize >= 17 && preset.settings.clarity <= 0.56
|
||||
)
|
||||
.map((preset) => preset.name);
|
||||
const softParticleNames = vibePresets
|
||||
.filter(
|
||||
(preset) => preset.settings.brushSize <= 5 && preset.settings.clarity <= 0.2
|
||||
)
|
||||
.map((preset) => preset.name);
|
||||
|
||||
expect(blendedNames).toEqual([
|
||||
'Aurora Mycelium',
|
||||
'Tidepool Lantern',
|
||||
]);
|
||||
expect(softParticleNames).toEqual(['Chrome Pollen']);
|
||||
});
|
||||
|
||||
it('stays inside interactive performance guardrails', () => {
|
||||
const violations = vibePresets.flatMap((preset) => {
|
||||
const { name, settings } = preset;
|
||||
const presetViolations: Array<string> = [];
|
||||
|
||||
if (settings.spawnPerPixel > 0.38) {
|
||||
presetViolations.push(`${name} density exceeds 0.38`);
|
||||
}
|
||||
if (settings.brushSize > 36) {
|
||||
presetViolations.push(`${name} brush size exceeds 36`);
|
||||
}
|
||||
if (
|
||||
settings.spawnPerPixel >= 0.28 &&
|
||||
(settings.decayRateTrails > 940 ||
|
||||
settings.brushSize > 14 ||
|
||||
settings.individualTrailWeight > 0.055)
|
||||
) {
|
||||
presetViolations.push(`${name} combines high density with too much persistence`);
|
||||
}
|
||||
|
||||
return presetViolations;
|
||||
});
|
||||
|
||||
expect(violations).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,5 +1,136 @@
|
|||
import { defaultGardenAudioVibeSettings } from '../audio/garden-audio-config';
|
||||
import { VibeId, type VibePreset } from './types';
|
||||
import {
|
||||
defaultGardenAudioVibeSettings,
|
||||
type GardenAudioChord,
|
||||
} from '../audio/garden-audio-config';
|
||||
import { VibeId, type GardenVibeSettings, type VibePreset } from './types';
|
||||
|
||||
type ColorReactionSettings = Pick<
|
||||
GardenVibeSettings,
|
||||
| 'color1ToColor1'
|
||||
| 'color1ToColor2'
|
||||
| 'color1ToColor3'
|
||||
| 'color2ToColor1'
|
||||
| 'color2ToColor2'
|
||||
| 'color2ToColor3'
|
||||
| 'color3ToColor1'
|
||||
| 'color3ToColor2'
|
||||
| 'color3ToColor3'
|
||||
>;
|
||||
|
||||
const colorReactions = {
|
||||
auroraMycelium: {
|
||||
color1ToColor1: 1,
|
||||
color1ToColor2: 1,
|
||||
color1ToColor3: 0,
|
||||
color2ToColor1: 0,
|
||||
color2ToColor2: 1,
|
||||
color2ToColor3: 1,
|
||||
color3ToColor1: 1,
|
||||
color3ToColor2: 0,
|
||||
color3ToColor3: 1,
|
||||
},
|
||||
velvetObservatory: {
|
||||
color1ToColor1: 1,
|
||||
color1ToColor2: -1,
|
||||
color1ToColor3: -1,
|
||||
color2ToColor1: -1,
|
||||
color2ToColor2: 1,
|
||||
color2ToColor3: -1,
|
||||
color3ToColor1: -1,
|
||||
color3ToColor2: -1,
|
||||
color3ToColor3: 1,
|
||||
},
|
||||
lichenSignal: {
|
||||
color1ToColor1: 0,
|
||||
color1ToColor2: -1,
|
||||
color1ToColor3: 1,
|
||||
color2ToColor1: -1,
|
||||
color2ToColor2: 0,
|
||||
color2ToColor3: -1,
|
||||
color3ToColor1: 1,
|
||||
color3ToColor2: -1,
|
||||
color3ToColor3: 1,
|
||||
},
|
||||
tidepoolLantern: {
|
||||
color1ToColor1: 0,
|
||||
color1ToColor2: 1,
|
||||
color1ToColor3: 0,
|
||||
color2ToColor1: 0,
|
||||
color2ToColor2: 0,
|
||||
color2ToColor3: 1,
|
||||
color3ToColor1: 1,
|
||||
color3ToColor2: 0,
|
||||
color3ToColor3: 0,
|
||||
},
|
||||
paperLanternFog: {
|
||||
color1ToColor1: 1,
|
||||
color1ToColor2: 1,
|
||||
color1ToColor3: 1,
|
||||
color2ToColor1: 1,
|
||||
color2ToColor2: 1,
|
||||
color2ToColor3: 1,
|
||||
color3ToColor1: 1,
|
||||
color3ToColor2: 1,
|
||||
color3ToColor3: 1,
|
||||
},
|
||||
chromePollen: {
|
||||
color1ToColor1: 1,
|
||||
color1ToColor2: 0,
|
||||
color1ToColor3: 1,
|
||||
color2ToColor1: -1,
|
||||
color2ToColor2: 1,
|
||||
color2ToColor3: 0,
|
||||
color3ToColor1: 1,
|
||||
color3ToColor2: 0,
|
||||
color3ToColor3: 1,
|
||||
},
|
||||
} satisfies Record<string, ColorReactionSettings>;
|
||||
|
||||
const musicScales = {
|
||||
dorian: [0, 2, 3, 5, 7, 9, 10],
|
||||
lydian: [0, 2, 4, 6, 7, 9, 11],
|
||||
mixolydian: [0, 2, 4, 5, 7, 9, 10],
|
||||
naturalMinor: [0, 2, 3, 5, 7, 8, 10],
|
||||
} satisfies Record<string, Array<number>>;
|
||||
|
||||
const musicProgressions = {
|
||||
aurora: [
|
||||
{ rootOffset: 0, quality: 'sus2' },
|
||||
{ rootOffset: 7, quality: 'major' },
|
||||
{ rootOffset: 9, quality: 'minor' },
|
||||
{ rootOffset: 5, quality: 'sus4' },
|
||||
],
|
||||
chrome: [
|
||||
{ rootOffset: 0, quality: 'major' },
|
||||
{ rootOffset: 2, quality: 'major' },
|
||||
{ rootOffset: 7, quality: 'sus2' },
|
||||
{ rootOffset: 9, quality: 'minor' },
|
||||
],
|
||||
lichen: [
|
||||
{ rootOffset: 0, quality: 'minor' },
|
||||
{ rootOffset: 5, quality: 'major' },
|
||||
{ rootOffset: 10, quality: 'major' },
|
||||
{ rootOffset: 3, quality: 'major' },
|
||||
],
|
||||
paperLantern: [
|
||||
{ rootOffset: 0, quality: 'minor' },
|
||||
{ rootOffset: 8, quality: 'major' },
|
||||
{ rootOffset: 5, quality: 'minor' },
|
||||
{ rootOffset: 10, quality: 'sus4' },
|
||||
],
|
||||
tidepool: [
|
||||
{ rootOffset: 0, quality: 'major' },
|
||||
{ rootOffset: 10, quality: 'major' },
|
||||
{ rootOffset: 5, quality: 'sus2' },
|
||||
{ rootOffset: 9, quality: 'minor' },
|
||||
],
|
||||
velvet: [
|
||||
{ rootOffset: 0, quality: 'minor' },
|
||||
{ rootOffset: 8, quality: 'major' },
|
||||
{ rootOffset: 3, quality: 'major' },
|
||||
{ rootOffset: 5, quality: 'sus4' },
|
||||
],
|
||||
} satisfies Record<string, Array<GardenAudioChord>>;
|
||||
|
||||
export const defaultVibeId = VibeId.AuroraMycelium;
|
||||
|
||||
|
|
@ -14,15 +145,20 @@ export const vibePresets: Array<VibePreset> = [
|
|||
],
|
||||
backgroundColor: [6, 13, 22],
|
||||
settings: {
|
||||
backgroundGrainStrength: 0.016,
|
||||
brushSize: 20,
|
||||
...colorReactions.auroraMycelium,
|
||||
backgroundGrainStrength: 0.014,
|
||||
brushSize: 21,
|
||||
clarity: 0.52,
|
||||
decayRateTrails: 988,
|
||||
individualTrailWeight: 0.085,
|
||||
forwardRotationScale: 0.28,
|
||||
individualTrailWeight: 0.082,
|
||||
moveSpeed: 54,
|
||||
sensorOffsetDistance: 72,
|
||||
spawnPerPixel: 0.13,
|
||||
turnSpeed: 35,
|
||||
sensorOffsetAngle: 36,
|
||||
sensorOffsetDistance: 76,
|
||||
spawnPerPixel: 0.14,
|
||||
strokeAngleJitterRadians: 1.45,
|
||||
turnSpeed: 34,
|
||||
turnWhenLost: 0.75,
|
||||
},
|
||||
audio: {
|
||||
...defaultGardenAudioVibeSettings,
|
||||
|
|
@ -33,130 +169,84 @@ export const vibePresets: Array<VibePreset> = [
|
|||
noteLength: 0.86,
|
||||
notePitchOffset: -2,
|
||||
brightness: 0.84,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: VibeId.EmberCircuit,
|
||||
name: 'Ember Circuit',
|
||||
colors: [
|
||||
[255, 95, 38],
|
||||
[255, 43, 132],
|
||||
[43, 219, 255],
|
||||
],
|
||||
backgroundColor: [17, 10, 8],
|
||||
settings: {
|
||||
backgroundGrainStrength: 0.03,
|
||||
brushSize: 8,
|
||||
clarity: 0.82,
|
||||
decayRateTrails: 918,
|
||||
individualTrailWeight: 0.04,
|
||||
moveSpeed: 150,
|
||||
sensorOffsetDistance: 24,
|
||||
spawnPerPixel: 0.31,
|
||||
turnSpeed: 130,
|
||||
},
|
||||
audio: {
|
||||
...defaultGardenAudioVibeSettings,
|
||||
idleIntensity: 0.03,
|
||||
bpm: 124,
|
||||
rampUpIntensity: 1.35,
|
||||
rampUpTime: 0.04,
|
||||
noteLength: 0.18,
|
||||
notePitchOffset: 7,
|
||||
brightness: 1.34,
|
||||
scale: musicScales.lydian,
|
||||
progression: musicProgressions.aurora,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: VibeId.VelvetObservatory,
|
||||
name: 'Velvet Observatory',
|
||||
colors: [
|
||||
[72, 98, 255],
|
||||
[255, 89, 176],
|
||||
[235, 236, 255],
|
||||
[178, 76, 62],
|
||||
[2, 174, 255],
|
||||
[213, 193, 9],
|
||||
],
|
||||
backgroundColor: [7, 8, 20],
|
||||
backgroundColor: [7, 4, 22],
|
||||
settings: {
|
||||
backgroundGrainStrength: 0.01,
|
||||
brushSize: 24,
|
||||
clarity: 0.45,
|
||||
decayRateTrails: 992,
|
||||
individualTrailWeight: 0.095,
|
||||
moveSpeed: 45,
|
||||
sensorOffsetDistance: 86,
|
||||
spawnPerPixel: 0.1,
|
||||
turnSpeed: 24,
|
||||
...colorReactions.velvetObservatory,
|
||||
backgroundGrainStrength: 0.005,
|
||||
brushSize: 9.75,
|
||||
clarity: 0.437,
|
||||
decayRateTrails: 915,
|
||||
forwardRotationScale: 2.0816681711721685e-17,
|
||||
individualTrailWeight: 0.1,
|
||||
moveSpeed: 216,
|
||||
sensorOffsetAngle: 24,
|
||||
sensorOffsetDistance: 17,
|
||||
spawnPerPixel: 0.24,
|
||||
strokeAngleJitterRadians: 0.16999999999999993,
|
||||
turnSpeed: 33,
|
||||
turnWhenLost: 0.42000000000000004,
|
||||
},
|
||||
audio: {
|
||||
...defaultGardenAudioVibeSettings,
|
||||
idleIntensity: 0.14,
|
||||
bpm: 56,
|
||||
rampUpIntensity: 0.6,
|
||||
rampUpTime: 0.16,
|
||||
noteLength: 1.15,
|
||||
notePitchOffset: -5,
|
||||
brightness: 0.72,
|
||||
idleIntensity: 0.55,
|
||||
bpm: 72,
|
||||
rampUpIntensity: 1.42,
|
||||
rampUpTime: 0.07000000000000002,
|
||||
noteLength: 0.7000000000000001,
|
||||
notePitchOffset: 0,
|
||||
brightness: 0.94,
|
||||
scale: musicScales.naturalMinor,
|
||||
progression: musicProgressions.velvet,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: VibeId.LichenSignal,
|
||||
name: 'Lichen Signal',
|
||||
colors: [
|
||||
[174, 205, 91],
|
||||
[71, 162, 126],
|
||||
[229, 117, 71],
|
||||
[183, 216, 92],
|
||||
[65, 166, 128],
|
||||
[238, 120, 76],
|
||||
],
|
||||
backgroundColor: [18, 24, 17],
|
||||
settings: {
|
||||
backgroundGrainStrength: 0.028,
|
||||
brushSize: 17,
|
||||
clarity: 0.66,
|
||||
decayRateTrails: 974,
|
||||
individualTrailWeight: 0.065,
|
||||
moveSpeed: 68,
|
||||
sensorOffsetDistance: 52,
|
||||
spawnPerPixel: 0.19,
|
||||
turnSpeed: 38,
|
||||
},
|
||||
audio: {
|
||||
...defaultGardenAudioVibeSettings,
|
||||
idleIntensity: 0.1,
|
||||
bpm: 68,
|
||||
rampUpIntensity: 0.8,
|
||||
rampUpTime: 0.1,
|
||||
noteLength: 0.62,
|
||||
notePitchOffset: -3,
|
||||
brightness: 0.82,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: VibeId.UltravioletSiren,
|
||||
name: 'Ultraviolet Siren',
|
||||
colors: [
|
||||
[184, 75, 255],
|
||||
[0, 224, 255],
|
||||
[214, 255, 72],
|
||||
],
|
||||
backgroundColor: [13, 9, 31],
|
||||
backgroundColor: [0, 0, 0],
|
||||
settings: {
|
||||
...colorReactions.lichenSignal,
|
||||
backgroundGrainStrength: 0.02,
|
||||
brushSize: 11,
|
||||
clarity: 0.72,
|
||||
decayRateTrails: 946,
|
||||
individualTrailWeight: 0.052,
|
||||
moveSpeed: 118,
|
||||
sensorOffsetDistance: 30,
|
||||
spawnPerPixel: 0.28,
|
||||
turnSpeed: 96,
|
||||
brushSize: 6.5,
|
||||
clarity: 0.74,
|
||||
decayRateTrails: 962,
|
||||
forwardRotationScale: 0.3,
|
||||
individualTrailWeight: 0.052000000000000005,
|
||||
moveSpeed: 72,
|
||||
sensorOffsetAngle: 42,
|
||||
sensorOffsetDistance: 54,
|
||||
spawnPerPixel: 0.15999999999999998,
|
||||
strokeAngleJitterRadians: 3.1399999999999997,
|
||||
turnSpeed: 44,
|
||||
turnWhenLost: 0.9200000000000002,
|
||||
},
|
||||
audio: {
|
||||
...defaultGardenAudioVibeSettings,
|
||||
idleIntensity: 0.04,
|
||||
bpm: 112,
|
||||
rampUpIntensity: 1.2,
|
||||
rampUpTime: 0.05,
|
||||
noteLength: 0.25,
|
||||
notePitchOffset: 5,
|
||||
brightness: 1.22,
|
||||
idleIntensity: 0.13,
|
||||
bpm: 68,
|
||||
rampUpIntensity: 1.46,
|
||||
rampUpTime: 0.10000000000000002,
|
||||
noteLength: 0.6,
|
||||
notePitchOffset: -3,
|
||||
brightness: 1.21,
|
||||
scale: musicScales.dorian,
|
||||
progression: musicProgressions.lichen,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -167,89 +257,110 @@ export const vibePresets: Array<VibePreset> = [
|
|||
[61, 118, 255],
|
||||
[255, 191, 91],
|
||||
],
|
||||
backgroundColor: [5, 20, 28],
|
||||
backgroundColor: [4, 18, 29],
|
||||
settings: {
|
||||
...colorReactions.tidepoolLantern,
|
||||
backgroundGrainStrength: 0.018,
|
||||
brushSize: 15,
|
||||
clarity: 0.6,
|
||||
decayRateTrails: 963,
|
||||
individualTrailWeight: 0.058,
|
||||
brushSize: 17,
|
||||
clarity: 0.56,
|
||||
decayRateTrails: 968,
|
||||
forwardRotationScale: 0.38,
|
||||
individualTrailWeight: 0.06,
|
||||
moveSpeed: 88,
|
||||
sensorOffsetDistance: 44,
|
||||
sensorOffsetAngle: 64,
|
||||
sensorOffsetDistance: 46,
|
||||
spawnPerPixel: 0.22,
|
||||
turnSpeed: 60,
|
||||
strokeAngleJitterRadians: 1.8,
|
||||
turnSpeed: 66,
|
||||
turnWhenLost: 1.05,
|
||||
},
|
||||
audio: {
|
||||
...defaultGardenAudioVibeSettings,
|
||||
idleIntensity: 0.08,
|
||||
bpm: 82,
|
||||
bpm: 84,
|
||||
rampUpIntensity: 0.95,
|
||||
rampUpTime: 0.08,
|
||||
noteLength: 0.48,
|
||||
noteLength: 0.46,
|
||||
notePitchOffset: 0,
|
||||
brightness: 0.98,
|
||||
scale: musicScales.mixolydian,
|
||||
progression: musicProgressions.tidepool,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: VibeId.PaperLanternFog,
|
||||
name: 'Paper Lantern Fog',
|
||||
name: 'Paper Lantern Fog Copy',
|
||||
colors: [
|
||||
[255, 174, 104],
|
||||
[242, 102, 107],
|
||||
[132, 211, 185],
|
||||
[255, 176, 108],
|
||||
[239, 90, 108],
|
||||
[128, 213, 184],
|
||||
],
|
||||
backgroundColor: [31, 23, 20],
|
||||
backgroundColor: [30, 23, 20],
|
||||
settings: {
|
||||
backgroundGrainStrength: 0.036,
|
||||
brushSize: 22,
|
||||
clarity: 0.5,
|
||||
decayRateTrails: 984,
|
||||
individualTrailWeight: 0.08,
|
||||
moveSpeed: 56,
|
||||
sensorOffsetDistance: 64,
|
||||
spawnPerPixel: 0.14,
|
||||
turnSpeed: 32,
|
||||
...colorReactions.paperLanternFog,
|
||||
backgroundGrainStrength: 0.038,
|
||||
brushSize: 3.5,
|
||||
clarity: 1,
|
||||
decayRateTrails: 999,
|
||||
forwardRotationScale: 0.24,
|
||||
individualTrailWeight: 0.937,
|
||||
moveSpeed: 28,
|
||||
sensorOffsetAngle: 34,
|
||||
sensorOffsetDistance: 66,
|
||||
spawnPerPixel: 0.05499999999999998,
|
||||
strokeAngleJitterRadians: 0,
|
||||
turnSpeed: 30,
|
||||
turnWhenLost: 1.52,
|
||||
},
|
||||
audio: {
|
||||
...defaultGardenAudioVibeSettings,
|
||||
idleIntensity: 0.13,
|
||||
bpm: 64,
|
||||
rampUpIntensity: 0.72,
|
||||
rampUpTime: 0.12,
|
||||
noteLength: 0.9,
|
||||
notePitchOffset: -4,
|
||||
brightness: 0.76,
|
||||
idleIntensity: 0.33,
|
||||
bpm: 127,
|
||||
rampUpIntensity: 0.66,
|
||||
rampUpTime: 0.03000000000000001,
|
||||
noteLength: 0.92,
|
||||
notePitchOffset: 10,
|
||||
brightness: 1.42,
|
||||
scale: musicScales.naturalMinor,
|
||||
progression: musicProgressions.paperLantern,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: VibeId.ChromePollen,
|
||||
name: 'Chrome Pollen',
|
||||
colors: [
|
||||
[235, 255, 238],
|
||||
[178, 34, 34],
|
||||
[255, 214, 48],
|
||||
[77, 240, 157],
|
||||
],
|
||||
backgroundColor: [9, 13, 12],
|
||||
backgroundColor: [7, 12, 11],
|
||||
settings: {
|
||||
...colorReactions.chromePollen,
|
||||
backgroundGrainStrength: 0.012,
|
||||
brushSize: 10,
|
||||
clarity: 0.9,
|
||||
decayRateTrails: 935,
|
||||
individualTrailWeight: 0.045,
|
||||
moveSpeed: 104,
|
||||
sensorOffsetDistance: 36,
|
||||
spawnPerPixel: 0.24,
|
||||
turnSpeed: 78,
|
||||
brushSize: 4.5,
|
||||
clarity: 0.1,
|
||||
decayRateTrails: 922,
|
||||
forwardRotationScale: 0.5,
|
||||
individualTrailWeight: 0.026000000000000002,
|
||||
moveSpeed: 86,
|
||||
sensorOffsetAngle: 46,
|
||||
sensorOffsetDistance: 14,
|
||||
spawnPerPixel: 0.36,
|
||||
strokeAngleJitterRadians: 3,
|
||||
turnSpeed: 34,
|
||||
turnWhenLost: 1.35,
|
||||
},
|
||||
audio: {
|
||||
...defaultGardenAudioVibeSettings,
|
||||
idleIntensity: 0.05,
|
||||
bpm: 96,
|
||||
rampUpIntensity: 1.05,
|
||||
rampUpTime: 0.07,
|
||||
noteLength: 0.3,
|
||||
notePitchOffset: 3,
|
||||
brightness: 1.18,
|
||||
idleIntensity: 0.11,
|
||||
bpm: 150,
|
||||
rampUpIntensity: 2,
|
||||
rampUpTime: 0.06000000000000001,
|
||||
noteLength: 1.8,
|
||||
notePitchOffset: -12,
|
||||
brightness: 0.5,
|
||||
scale: musicScales.lydian,
|
||||
progression: musicProgressions.chrome,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
|
||||
import { appConfig } from '../config';
|
||||
import { getRenderQualityBrushSize } from '../config/brush-size';
|
||||
import { AgentGenerationPipeline } from '../pipelines/agents/agent-generation/agent-generation-pipeline';
|
||||
import { AGENT_FLOAT_COUNT, writeAgentValues } from '../pipelines/agents/agent-limits';
|
||||
import { getSafePixelRatio } from '../pipelines/brush/brush-pipeline';
|
||||
|
|
@ -162,7 +163,11 @@ export class AgentPopulation {
|
|||
}
|
||||
|
||||
const baseAngle = Math.atan2(deltaY, deltaX);
|
||||
const spread = settings.brushSize * getSafePixelRatio(this.getCanvasPixelRatio());
|
||||
const spread =
|
||||
getRenderQualityBrushSize(
|
||||
settings.brushSize,
|
||||
settings.internalRenderAreaMegapixels
|
||||
) * getSafePixelRatio(this.getCanvasPixelRatio());
|
||||
const batchCapacity = this.strokeAgentData.length / AGENT_FLOAT_COUNT;
|
||||
if (batchCapacity <= 0) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { vec2 } from 'gl-matrix';
|
||||
|
||||
import { appConfig } from '../config';
|
||||
import { getRenderQualityBrushSize } from '../config/brush-size';
|
||||
import { getSafePixelRatio } from '../pipelines/brush/brush-pipeline';
|
||||
import { settings } from '../settings';
|
||||
import { type StrokeSegment } from './game-loop-types';
|
||||
|
|
@ -90,9 +91,13 @@ export class BrushStrokeSmoother {
|
|||
): Array<StrokeSegment> {
|
||||
const curveLength = vec2.distance(start, control) + vec2.distance(control, end);
|
||||
const canvasPixelRatio = getSafePixelRatio(this.options.getCanvasPixelRatio());
|
||||
const brushSize = getRenderQualityBrushSize(
|
||||
settings.brushSize,
|
||||
settings.internalRenderAreaMegapixels
|
||||
);
|
||||
const brushRadius = Math.max(
|
||||
settings.brushCurveMinBrushRadius * canvasPixelRatio,
|
||||
(settings.brushSize * canvasPixelRatio) / 2
|
||||
(brushSize * canvasPixelRatio) / 2
|
||||
);
|
||||
const segmentSpacing = Math.max(
|
||||
settings.brushCurveMinSegmentSpacing * canvasPixelRatio,
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue