在AS3中应用双色转换
简而言之,我想将几个MovieClips设置为不同的特定颜色,然后在它们上涂上色调。
var color1 = new ColorTransform(); color1.color = 0x0000FF;
var color2 = new ColorTransform(); color2.color = 0x00FF00;
var color3 = new ColorTransform(); color3.color = 0xFFFF00;
thing1.transform.colorTransform = color1;
thing2.transform.colorTransform = color2;
thing3.transform.colorTransform = color3;
thing1.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 200, 150, 0);
thing2.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 200, 150, 0);
thing3.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 200, 150, 0);
不幸的是,ColorTransform重置该值。有什么方法可以保持第一个颜色转换的价值?
Simply put, I would like to set several movieclips to different specific colors and then apply a tint over them.
var color1 = new ColorTransform(); color1.color = 0x0000FF;
var color2 = new ColorTransform(); color2.color = 0x00FF00;
var color3 = new ColorTransform(); color3.color = 0xFFFF00;
thing1.transform.colorTransform = color1;
thing2.transform.colorTransform = color2;
thing3.transform.colorTransform = color3;
thing1.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 200, 150, 0);
thing2.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 200, 150, 0);
thing3.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0, 200, 150, 0);
unfortunately the colortransform resets the value. Any way to keep the value of the first color transform?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您应该能够使用 colortransform.concat()函数。
本质上与(使用
Math.min.min
将偏移值固定为255):或:
You should be able to do that with the ColorTransform.concat() function.
Which essentially is the same as (clamping offset values to 255 using
Math.min
):Or:
我找到了解决这个问题的解决方案。
如果我将对象设置为颜色,
则可以编辑蓝色和绿色值,以获取所需的色彩
,然后在对象上使用colortransform设置新颜色
I've found a solution to this problem.
If I set an object to a color
I can then edit the blue and green values as so to get my desired tint
And then use colortransform on the object to set the new color