File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -960,8 +960,8 @@ p5.prototype.hue = function(c) {
960
960
* <a href="#/p5/colorMode">colorMode()</a>.
961
961
*
962
962
* @method lerpColor
963
- * @param {p5.Color } c1 interpolate from this color.
964
- * @param {p5.Color } c2 interpolate to this color.
963
+ * @param {p5.Color } c1 interpolate from this color (any value created by the color() function) .
964
+ * @param {p5.Color } c2 interpolate to this color (any value created by the color() function) .
965
965
* @param {Number } amt number between 0 and 1.
966
966
* @return {p5.Color } interpolated color.
967
967
*
@@ -1007,6 +1007,14 @@ p5.prototype.hue = function(c) {
1007
1007
*/
1008
1008
p5 . prototype . lerpColor = function ( c1 , c2 , amt ) {
1009
1009
p5 . _validateParameters ( 'lerpColor' , arguments ) ;
1010
+
1011
+ if ( ! ( c1 instanceof p5 . Color ) ) {
1012
+ c1 = color ( c1 ) ;
1013
+ }
1014
+ if ( ! ( c2 instanceof p5 . Color ) ) {
1015
+ c2 = color ( c2 ) ;
1016
+ }
1017
+
1010
1018
const mode = this . _colorMode ;
1011
1019
const maxes = this . _colorMaxes ;
1012
1020
let l0 , l1 , l2 , l3 ;
You can’t perform that action at this time.
0 commit comments