webgl中所使用的颜色值域为0~1
,超出1的部分则自动截取为1
css中的颜色值域为0~255
因为同为RGB颜色,所以转换方法为 颜色值/255
一般取两位小数即可,需要更精准则取更多小数
js做简单的数值转换
1 | const t = (d, h = 3) => { |
webgl中所使用的颜色值域为0~1
,超出1的部分则自动截取为1
css中的颜色值域为0~255
因为同为RGB颜色,所以转换方法为 颜色值/255
一般取两位小数即可,需要更精准则取更多小数
js做简单的数值转换
1 | const t = (d, h = 3) => { |
Update your browser to view this website correctly. Update my browser now