flash - 如何在 actionscript 3 中计算给定十六进制颜色的阴影?

标签 flash actionscript-3 actionscript colors

我需要一种方法来根据提供的颜色计算较浅的十六进制颜色。我意识到我可以使用颜色变换,但我需要实际值才能生成渐变。

最佳答案

这是我为最近的一个项目编写的一个函数,它允许您根据 0-1 的范围找到其他两个之间的颜色值。我认为它会满足您的需求

private function getBetweenColourByPercent(value:Number = 0.5 /* 0-1 */, highColor:uint = 0xFFFFFF, lowColor:uint = 0x000000):uint {
    var r:uint = highColor >> 16;
    var g:uint = highColor >> 8 & 0xFF;
    var b:uint = highColor & 0xFF;

    r += ((lowColor >> 16) - r) * value;
    g += ((lowColor >> 8 & 0xFF) - g) * value;
    b += ((lowColor & 0xFF) - b) * value;

    return (r << 16 | g << 8 | b);
}

关于flash - 如何在 actionscript 3 中计算给定十六进制颜色的阴影?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2258800/

相关文章:

c# - asp.net(C#)提交两三个表单后如何获取First flash文件数据?

javascript - 谷歌 IMA + MediaElementJS

performance - 除了渲染向量之外,AS3 中的主要性能影响因素是什么?

apache-flex - 在 flex 中显示麦克风事件

apache-flex - 我可以在 MXML 的一个文件中包含多个类吗?

actionscript-3 - 在套接字上使用readObject时出现“index is out of bounds”错误

actionscript-3 - AS3 : "Variable [x] is not defined" error when using getDefinitionByName()

javascript - swfaddress-optimizer.js 的文档在哪里?

actionscript-3 - 如何在 ActionScript 中拆分音频文件

javascript - 生成加权随机数