簡而言之,我想將幾??個影片剪輯設定為不同的特定顏色,然后在它們上應用色調。
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);
不幸的是,顏色變換會重置該值。有什么方法可以保持第一次顏色變換的值?
uj5u.com熱心網友回復:
您應該可以使用ColorTransform.concat()函式來做到這一點。
var color1 = new ColorTransform(); color1.color = 0x0000FF;
var color2 = new ColorTransform(); color2.color = 0x00FF00;
var color3 = new ColorTransform(); color3.color = 0xFFFF00;
color1.concat( new ColorTransform(1, 1, 1, 1, 0, 200, 150, 0) );
color2.concat( new ColorTransform(1, 1, 1, 1, 0, 200, 150, 0) );
color3.concat( new ColorTransform(1, 1, 1, 1, 0, 200, 150, 0) );
thing1.transform.colorTransform = color1;
thing2.transform.colorTransform = color2;
thing3.transform.colorTransform = color3;
這基本上與(使用 將偏移值限制為 255 Math.min)相同:
thing1.transform.colorTransform = new ColorTransform(1*1, 1*1, 1*1, 1*1, Math.min(0x00 0, 0xFF), Math.min(0x00 200, 0xFF), Math.min(0xFF 150, 0xFF), Math.min(0x00 0, 0xFF));
thing2.transform.colorTransform = new ColorTransform(1*1, 1*1, 1*1, 1*1, Math.min(0x00 0, 0xFF), Math.min(0xFF 200, 0xFF), Math.min(0x00 150, 0xFF), Math.min(0x00 0, 0xFF));
thing3.transform.colorTransform = new ColorTransform(1*1, 1*1, 1*1, 1*1, Math.min(0xFF 0, 0xFF), Math.min(0xFF 200, 0xFF), Math.min(0x00 150, 0xFF), Math.min(0x00 0, 0xFF));
或者:
thing1.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0x00, 0xC8, 0xFF, 0x00);
thing2.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0x00, 0xFF, 0x96, 0x00);
thing3.transform.colorTransform = new ColorTransform(1, 1, 1, 1, 0xFF, 0xFF, 0x96, 0x00);
uj5u.com熱心網友回復:
我找到了解決這個問題的方法。
如果我將一個物件設定為一種顏色
var color1 = new ColorTransform(); color1.color = 0x0000FF;
thing1.transform.colorTransform = color1;
然后我可以編輯藍色和綠色值以獲得我想要的色調
color1.blueOffset =200;
color1.greenOffset =150;
然后在物件上使用 colortransform 設定新顏色
thing1.transform.colorTransform = color1;
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/473851.html
標籤:actionscript-3 颜色
上一篇:如何在AS3中呼叫顏色變換
