gradient function
returns an length n
array of Vector3 colours. colours are between color1
and color2
, and are spaced according to the easing function easeFn
.
Implementation
List<List<num>> gradient(
Function ease, int n, List<num> color1, List<num> color2) {
var d = (n - 1 != 0) ? n - 1 : 1;
var result =
List.generate(n, (i) => lerp3(ease(i / d), color1, color2)).toList();
return result;
}