-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSliderVal.ts
87 lines (79 loc) · 1.4 KB
/
SliderVal.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { Dict } from './lib/juego/util.js'
type SliderVal = {
id: string,
val: number;
default: number;
}
export let vals: Dict<SliderVal> = {
satCutoff: {
id: 'sat-cutoff',
val: 300,
default: 300,
},
satPower: {
id: 'sat-power',
val: 1.0,
default: 1.0,
},
satMin: {
id: 'sat-min',
val: 0.3,
default: 0.3,
},
lumCutoff: { // distance over which luminance factor descends to the minimum
id: 'lum-cutoff',
val: 500,
default: 500,
},
lumPower: {
id: 'lum-power',
val: 1.0,
default: 1.0,
},
lumMin: { // minimum luminance factor for any occupied slice
id: 'lum-min',
val: 0.2,
default: 0.2,
},
shading: {
id: 'shading',
val: 0.3,
default: 0.3,
},
lens: {
id: 'lens',
val: 2,
default: 2,
},
cornerCutoff: {
id: 'corner-cutoff',
val: 50,
default: 50
},
cornerFactor: {
id: 'corner-factor',
val: 0.5,
default: 0.5
},
nearMix: {
id: 'near-mix',
val: 0.0,
default: 0.0
},
hueDescentRatio: {
id: 'hue-descent-ratio',
val: 2.0,
default: 2.0
}
}
if ( typeof document !== 'undefined' ) {
for ( let valName in vals ) {
let slider = document.getElementById( vals[valName].id ) as HTMLInputElement;
if ( !slider ) continue;
slider.value = vals[valName].val.toString();
slider.onchange = function( e: any ) {
let inputVal = parseFloat( e.currentTarget.value );
if ( !isNaN( inputVal ) ) vals[valName].val = inputVal;
}
}
}