颜色渐变的数学 [英] Maths for color gradient

查看:312
本文介绍了颜色渐变的数学的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何用于制作(简单)颜色渐变的数学?
我正在寻找一个简单的梯度方法。
不是特定的语言。只是数学的颜色。

Is any Maths for making a (simple) color gradient? I'm looking for simple methods of making a gradient. Not in a specific language. Just the maths of colors.

推荐答案

一般来说,颜色渐变是一种线性函数,例如,如果要生成从红色(100%,0%,0%)到蓝色(0%,0%,100%)的渐变,则可以将每个颜色值从其初始值扫描到其目标值。

In general, a colour gradient is a linear function for easing from one colour to another. For instance, if you wanted to produce a gradient from red (100%, 0%, 0%) to blue (0%, 0%, 100%), you would sweep each colour value from its initial value to its target value.

在渐变的中间,颜色值将等于第一种颜色的50%,添加到第二种颜色的50%。在此示例中,您最终会显示(50%,0%,50%) - 等于紫色。

At the middle of the gradient, the colour value would be equal to 50% of the first colour, added to 50% of the second colour. In this example, you'd end up with (50%, 0%, 50%) - which is equal to purple.

这篇关于颜色渐变的数学的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆