feat: colors
This commit is contained in:
@@ -7,19 +7,17 @@ class NebulaDriftPreset extends BasePreset {
|
||||
constructor(width = 16, height = 16) {
|
||||
super(width, height);
|
||||
this.timeSeconds = 0;
|
||||
this.paletteStops = [
|
||||
{ stop: 0.0, color: hexToRgb('100406') },
|
||||
{ stop: 0.25, color: hexToRgb('2e0f1f') },
|
||||
{ stop: 0.5, color: hexToRgb('6a1731') },
|
||||
{ stop: 0.7, color: hexToRgb('b63b32') },
|
||||
{ stop: 0.85, color: hexToRgb('f48b2a') },
|
||||
{ stop: 1.0, color: hexToRgb('ffe9b0') },
|
||||
];
|
||||
this.defaultParameters = {
|
||||
primarySpeed: 0.15,
|
||||
secondarySpeed: 0.32,
|
||||
waveScale: 0.75,
|
||||
brightness: 1.0,
|
||||
color1: '100406',
|
||||
color2: '2e0f1f',
|
||||
color3: '6a1731',
|
||||
color4: 'b63b32',
|
||||
color5: 'f48b2a',
|
||||
color6: 'ffe9b0',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -33,6 +31,15 @@ class NebulaDriftPreset extends BasePreset {
|
||||
const frame = createFrame(this.width, this.height);
|
||||
const brightness = this.getParameter('brightness') || 1.0;
|
||||
|
||||
const paletteStops = [
|
||||
{ stop: 0.0, color: hexToRgb(this.getParameter('color1') || '100406') },
|
||||
{ stop: 0.25, color: hexToRgb(this.getParameter('color2') || '2e0f1f') },
|
||||
{ stop: 0.5, color: hexToRgb(this.getParameter('color3') || '6a1731') },
|
||||
{ stop: 0.7, color: hexToRgb(this.getParameter('color4') || 'b63b32') },
|
||||
{ stop: 0.85, color: hexToRgb(this.getParameter('color5') || 'f48b2a') },
|
||||
{ stop: 1.0, color: hexToRgb(this.getParameter('color6') || 'ffe9b0') },
|
||||
];
|
||||
|
||||
for (let row = 0; row < this.height; ++row) {
|
||||
const v = row / Math.max(1, this.height - 1);
|
||||
for (let col = 0; col < this.width; ++col) {
|
||||
@@ -45,7 +52,7 @@ class NebulaDriftPreset extends BasePreset {
|
||||
const envelope = Math.sin((u * v) * Math.PI * 2 + this.timeSeconds * 0.1) * 0.25 + 0.75;
|
||||
const value = clamp((combined * 0.5 + 0.5) * envelope, 0, 1);
|
||||
|
||||
let color = samplePalette(this.paletteStops, value);
|
||||
let color = samplePalette(paletteStops, value);
|
||||
|
||||
// Apply brightness
|
||||
if (brightness < 1.0) {
|
||||
@@ -71,6 +78,12 @@ class NebulaDriftPreset extends BasePreset {
|
||||
secondarySpeed: { type: 'range', min: 0.2, max: 0.5, step: 0.02, default: 0.32 },
|
||||
waveScale: { type: 'range', min: 0.5, max: 1.0, step: 0.05, default: 0.75 },
|
||||
brightness: { type: 'range', min: 0.3, max: 1.0, step: 0.1, default: 1.0 },
|
||||
color1: { type: 'color', default: '100406' },
|
||||
color2: { type: 'color', default: '2e0f1f' },
|
||||
color3: { type: 'color', default: '6a1731' },
|
||||
color4: { type: 'color', default: 'b63b32' },
|
||||
color5: { type: 'color', default: 'f48b2a' },
|
||||
color6: { type: 'color', default: 'ffe9b0' },
|
||||
},
|
||||
width: this.width,
|
||||
height: this.height,
|
||||
|
||||
Reference in New Issue
Block a user