sample-linear-gradient ( colors percent -- color )


Vocabulary
colors.mix

Inputs
colorsan object
percentan object


Outputs
coloran object


Definition


:: sample-linear-gradient ( colors percent -- color )
colors length :> num-colors num-colors 1 - percent *
>integer :> left-index 1.0 num-colors 1 - /
:> cell-range percent left-index cell-range * - cell-range /
:> alpha left-index colors nth :> left-color left-index 1 +
num-colors mod colors nth
:> right-color left-color right-color alpha linear-gradient
;