-
Notifications
You must be signed in to change notification settings - Fork 21
/
smoother.jsfx-inc
51 lines (47 loc) · 996 Bytes
/
smoother.jsfx-inc
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
/*
// init
smoother_init(var1);
smoother_init(var2);
// block
smoothing = smoother_block(var1) + smoother_block(var2);
// sample
smoothing ? (
smoother_block(var1);
smoother_sample(var2);
);
*/
@init
function smoother_init(slidervar*) (
slidervar.value = slidervar;
slidervar.step = 0;
1;
);
function smoother_block(slidervar*, modulo) local(half) (
slidervar != slidervar.value ? (
half = modulo*0.5;
while (slidervar - slidervar.value > half) (
slidervar.value += modulo;
);
while (slidervar - slidervar.value < -half) (
slidervar.value -= modulo;
);
slidervar.step = (slidervar - slidervar.value)/samplesblock;
1;
) : (
slidervar.step = 0;
);
);
function smoother_block(slidervar*) (
slidervar != slidervar.value ? (
slidervar.step = (slidervar - slidervar.value)/samplesblock;
1;
) : (
slidervar.step = 0;
);
);
function smoother_sample(slidervar*) (
slidervar.value += slidervar.step;
);
function smoother_value(slidervar*) (
slidervar.value;
);