titanscssc::lib_mix PHP Method

lib_mix() protected method

protected lib_mix ( $args )
    protected function lib_mix($args)
    {
        list($first, $second, $weight) = $args;
        $first = $this->assertColor($first);
        $second = $this->assertColor($second);
        if (is_null($weight)) {
            $weight = 0.5;
        } else {
            $weight = $this->coercePercent($weight);
        }
        $firstAlpha = isset($first[4]) ? $first[4] : 1;
        $secondAlpha = isset($second[4]) ? $second[4] : 1;
        $w = $weight * 2 - 1;
        $a = $firstAlpha - $secondAlpha;
        $w1 = (($w * $a == -1 ? $w : ($w + $a) / (1 + $w * $a)) + 1) / 2.0;
        $w2 = 1.0 - $w1;
        $new = array('color', $w1 * $first[1] + $w2 * $second[1], $w1 * $first[2] + $w2 * $second[2], $w1 * $first[3] + $w2 * $second[3]);
        if ($firstAlpha != 1.0 || $secondAlpha != 1.0) {
            $new[] = $firstAlpha * $weight + $secondAlpha * ($weight - 1);
        }
        return $this->fixColor($new);
    }
titanscssc