mirror of
https://github.com/Ttanasart-pt/Pixel-Composer.git
synced 2024-12-26 15:06:22 +01:00
18 lines
No EOL
462 B
Text
18 lines
No EOL
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;
|
|
} |