Loading

PlerpColor


processing
Since v1.0.0
Available on all platforms
See also

Calculates a color between two colors at a specific increment. The amt parameter is the amount to interpolate between the two values where 0.0 is equal to the first point, 0.1 is very near the first point, 0.5 is halfway in between, etc.

An amount below 0 will be treated as 0. Likewise, amounts above 1 will be capped at 1. This is different from the behavior of Plerp, but necessary because otherwise numbers outside the range will produce strange and unexpected colors.

Link to original Processing doc

Signature

Examples

// @preview image 100 100 '2D2' PGraphics 51 Pbackground 204 102 0 Pcolor 'from' STORE 0 102 153 Pcolor 'to' STORE $from $to 0.33 PlerpColor 'interA' STORE $from $to 0.66 PlerpColor 'interB' STORE $from Pfill 10 20 20 60 Prect $interA Pfill 30 20 20 60 Prect $interB Pfill 50 20 20 60 Prect $to Pfill 70 20 20 60 Prect Pencode