Last active
April 4, 2022 23:11
-
-
Save indrih17/db94c88555c8ae95efeb1089df0b1594 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Найти цвет в точке между двумя цветами в заданном месте. | |
* @param percent Значение в диапазоне от 0 до 1. | |
*/ | |
fun pointBetweenColors(from: Float, to: Float, percent: Float): Float = | |
from + percent * (to - from) | |
/** | |
* Найти цвет в точке между двумя цветами в заданном месте. | |
* @param percent Значение в диапазоне от 0 до 1. | |
*/ | |
fun pointBetweenColors(from: Color, to: Color, percent: Float) = Color( | |
red = pointBetweenColors(from.red, to.red, percent), | |
green = pointBetweenColors(from.green, to.green, percent), | |
blue = pointBetweenColors(from.blue, to.blue, percent), | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment