mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-27 07:26:33 +01:00
18 lines
462 B
Text
18 lines
462 B
Text
|
function getWiggle(_min, _max, _fmin, _fmax, _time, seed_shift = 0) {
|
||
|
random_set_seed(GLOBAL_SEED + seed_shift);
|
||
|
|
||
|
var _x0 = random_range(_min, _max);
|
||
|
var _x1 = random_range(_min, _max);
|
||
|
var _t_next = 0, _t_prev = 0;
|
||
|
|
||
|
while(_t_next < _time) {
|
||
|
_x0 = _x1;
|
||
|
_x1 = random_range(_min, _max);
|
||
|
|
||
|
_t_prev = _t_next;
|
||
|
_t_next = _t_prev + irandom_range(_fmin, _fmax);
|
||
|
}
|
||
|
|
||
|
var _val = lerp(_x0, _x1, (_time - _t_prev) / (_t_next - _t_prev));
|
||
|
return _val;
|
||
|
}
|