feat: colors
This commit is contained in:
@@ -8,19 +8,17 @@ class SpiralBloomPreset extends BasePreset {
|
||||
super(width, height);
|
||||
this.rotation = 0;
|
||||
this.hueShift = 0;
|
||||
this.paletteStops = [
|
||||
{ stop: 0.0, color: hexToRgb('051923') },
|
||||
{ stop: 0.2, color: hexToRgb('0c4057') },
|
||||
{ stop: 0.45, color: hexToRgb('1d7a70') },
|
||||
{ stop: 0.7, color: hexToRgb('39b15f') },
|
||||
{ stop: 0.88, color: hexToRgb('9dd54c') },
|
||||
{ stop: 1.0, color: hexToRgb('f7f5bc') },
|
||||
];
|
||||
this.defaultParameters = {
|
||||
rotationSpeed: 0.7,
|
||||
hueSpeed: 0.2,
|
||||
spiralArms: 5,
|
||||
brightness: 1.0,
|
||||
color1: '051923',
|
||||
color2: '0c4057',
|
||||
color3: '1d7a70',
|
||||
color4: '39b15f',
|
||||
color5: '9dd54c',
|
||||
color6: 'f7f5bc',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,6 +30,15 @@ class SpiralBloomPreset extends BasePreset {
|
||||
const brightness = this.getParameter('brightness') || 1.0;
|
||||
const spiralArms = this.getParameter('spiralArms') || 5;
|
||||
|
||||
const paletteStops = [
|
||||
{ stop: 0.0, color: hexToRgb(this.getParameter('color1') || '051923') },
|
||||
{ stop: 0.2, color: hexToRgb(this.getParameter('color2') || '0c4057') },
|
||||
{ stop: 0.45, color: hexToRgb(this.getParameter('color3') || '1d7a70') },
|
||||
{ stop: 0.7, color: hexToRgb(this.getParameter('color4') || '39b15f') },
|
||||
{ stop: 0.88, color: hexToRgb(this.getParameter('color5') || '9dd54c') },
|
||||
{ stop: 1.0, color: hexToRgb(this.getParameter('color6') || 'f7f5bc') },
|
||||
];
|
||||
|
||||
const cx = (this.width - 1) / 2;
|
||||
const cy = (this.height - 1) / 2;
|
||||
const radiusNorm = Math.hypot(cx, cy) || 1;
|
||||
@@ -45,7 +52,7 @@ class SpiralBloomPreset extends BasePreset {
|
||||
const arm = 0.5 + 0.5 * Math.sin(spiralArms * (angle + this.rotation) + this.hueShift * Math.PI * 2);
|
||||
const value = Math.min(1, radius * 0.8 + arm * 0.4);
|
||||
|
||||
let color = samplePalette(this.paletteStops, value);
|
||||
let color = samplePalette(paletteStops, value);
|
||||
|
||||
// Apply brightness
|
||||
if (brightness < 1.0) {
|
||||
@@ -71,6 +78,12 @@ class SpiralBloomPreset extends BasePreset {
|
||||
hueSpeed: { type: 'range', min: 0.1, max: 0.5, step: 0.05, default: 0.2 },
|
||||
spiralArms: { type: 'range', min: 3, max: 8, step: 1, default: 5 },
|
||||
brightness: { type: 'range', min: 0.3, max: 1.0, step: 0.1, default: 1.0 },
|
||||
color1: { type: 'color', default: '051923' },
|
||||
color2: { type: 'color', default: '0c4057' },
|
||||
color3: { type: 'color', default: '1d7a70' },
|
||||
color4: { type: 'color', default: '39b15f' },
|
||||
color5: { type: 'color', default: '9dd54c' },
|
||||
color6: { type: 'color', default: 'f7f5bc' },
|
||||
},
|
||||
width: this.width,
|
||||
height: this.height,
|
||||
|
||||
Reference in New Issue
Block a user