mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-11-10 20:45:35 +01:00
18 lines
462 B
Plaintext
18 lines
462 B
Plaintext
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;
|
|
} |