return 'rgba(' . self::_to255($this->_red) . ', ' . self::_to255($this->_green) . ', ' . self::_to255($this->_blue) . ', ' . $this->_alpha . ')';
}
+ /**
+ * @return float[]
+ */
+ public function toLottie()
+ {
+ // Lottie colors are decimal numbers between 0 (0) and 1 (255) rounded at 12 digits
+ $digits = 12;
+ return [round($this->_red, $digits), round($this->_green, $digits), round($this->_blue, $digits), round($this->_alpha, $digits)];
+
+ }
+
public function toHexRVB()
{
return $this->toHexComposante('red') . $this->toHexComposante('green') . $this->toHexComposante('blue');
*/
public function distance(Color $color)
{
-
return (30 * ($color->toIntComposante('red') - $this->toIntComposante('red'))) ** 2 +
(59 * ($color->toIntComposante('green') - $this->toIntComposante('green'))) ** 2 +
(11 * ($color->toIntComposante('blue') - $this->toIntComposante('blue'))) ** 2;