feat: colors
This commit is contained in:
@@ -7,19 +7,17 @@ class OceanGlimmerPreset extends BasePreset {
|
||||
constructor(width = 16, height = 16) {
|
||||
super(width, height);
|
||||
this.timeSeconds = 0;
|
||||
this.paletteStops = [
|
||||
{ stop: 0.0, color: hexToRgb('031521') },
|
||||
{ stop: 0.35, color: hexToRgb('024f6d') },
|
||||
{ stop: 0.65, color: hexToRgb('13a4a1') },
|
||||
{ stop: 0.85, color: hexToRgb('67dcd0') },
|
||||
{ stop: 1.0, color: hexToRgb('fcdba4') },
|
||||
];
|
||||
this.defaultParameters = {
|
||||
shimmer: 0.08,
|
||||
waveSpeed1: 1.2,
|
||||
waveSpeed2: 0.9,
|
||||
waveSpeed3: 0.5,
|
||||
brightness: 1.0,
|
||||
color1: '031521',
|
||||
color2: '024f6d',
|
||||
color3: '13a4a1',
|
||||
color4: '67dcd0',
|
||||
color5: 'fcdba4',
|
||||
};
|
||||
}
|
||||
|
||||
@@ -30,6 +28,14 @@ class OceanGlimmerPreset extends BasePreset {
|
||||
const shimmer = this.getParameter('shimmer') || 0.08;
|
||||
const brightness = this.getParameter('brightness') || 1.0;
|
||||
|
||||
const paletteStops = [
|
||||
{ stop: 0.0, color: hexToRgb(this.getParameter('color1') || '031521') },
|
||||
{ stop: 0.35, color: hexToRgb(this.getParameter('color2') || '024f6d') },
|
||||
{ stop: 0.65, color: hexToRgb(this.getParameter('color3') || '13a4a1') },
|
||||
{ stop: 0.85, color: hexToRgb(this.getParameter('color4') || '67dcd0') },
|
||||
{ stop: 1.0, color: hexToRgb(this.getParameter('color5') || 'fcdba4') },
|
||||
];
|
||||
|
||||
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) {
|
||||
@@ -42,7 +48,7 @@ class OceanGlimmerPreset extends BasePreset {
|
||||
const noise = (Math.random() - 0.5) * shimmer;
|
||||
const value = clamp(base + noise, 0, 1);
|
||||
|
||||
let color = samplePalette(this.paletteStops, value);
|
||||
let color = samplePalette(paletteStops, value);
|
||||
|
||||
// Apply brightness
|
||||
if (brightness < 1.0) {
|
||||
@@ -69,6 +75,11 @@ class OceanGlimmerPreset extends BasePreset {
|
||||
waveSpeed2: { type: 'range', min: 0.5, max: 2.0, step: 0.1, default: 0.9 },
|
||||
waveSpeed3: { type: 'range', min: 0.2, max: 1.0, step: 0.1, default: 0.5 },
|
||||
brightness: { type: 'range', min: 0.3, max: 1.0, step: 0.1, default: 1.0 },
|
||||
color1: { type: 'color', default: '031521' },
|
||||
color2: { type: 'color', default: '024f6d' },
|
||||
color3: { type: 'color', default: '13a4a1' },
|
||||
color4: { type: 'color', default: '67dcd0' },
|
||||
color5: { type: 'color', default: 'fcdba4' },
|
||||
},
|
||||
width: this.width,
|
||||
height: this.height,
|
||||
|
||||
Reference in New Issue
Block a user