Class: ColorTransform

ColorTransform

ColorTransform クラスを使用すると、表示オブジェクトのカラー値を調整することができます。
カラー調整、つまり "カラー変換" は、赤、緑、青、アルファ透明度の 4 つのチャンネルすべてに適用できます。

  • 新しい red 値 = (古い red 値 * redMultiplier ) + redOffset
  • 新しい green 値 = (古い green 値 * greenMultiplier ) + greenOffset
  • 新しい blue 値 = (古い blue 値 * blueMultiplier ) + blueOffset
  • 新しい alpha 値 = (古い alpha 値 * alphaMultiplier ) + alphaOffset
算出後、カラーチャンネル値が 255 よりも大きい場合は 255 に設定されます。 0 より小さい場合は 0 に設定されます。

The ColorTransform class lets you adjust the color values in a display object.
The color adjustment or color transformation can be applied
to all four channels: red, green, blue, and alpha transparency.

  • New red value = (old red value * redMultiplier) + redOffset
  • New green value = (old green value * greenMultiplier) + greenOffset
  • New blue value = (old blue value * blueMultiplier) + blueOffset
  • New alpha value = (old alpha value * alphaMultiplier) + alphaOffset
If any of the color channel values is greater than 255 after the calculation, it is set to 255. If it is less than 0, it is set to 0.

new next2d.geom.ColorTransform (red_multiplier, green_multiplier, blue_multiplier, alpha_multiplier, red_offset, green_offset, blue_offset, alpha_offset)

NameTypeDefaultDescription
red_multipliernumber1optional
green_multipliernumber1optional
blue_multipliernumber1optional
alpha_multipliernumber1optional
red_offsetnumber0optional
green_offsetnumber0optional
blue_offsetnumber0optional
alpha_offsetnumber0optional
Example

Example usage of ColorTransform.

// new ColorTransform
const {ColorTransform} = next2d.geom;
const colorTransform   = new ColorTransform();
// set new ColorTransform
const {MovieClip} = next2d.display;
const movieClip   = new MovieClip();
movieClip.transform.colorTransform = colorTransform;

Members

next2d.geom.ColorTransform.namespace string staticconstant

指定されたクラスの空間名を返します。
Returns the space name of the specified class.

Default Value:
  • next2d.geom.ColorTransform

alphaMultiplier number

アルファ透明度チャンネル値に乗算する 10 進数値です。
A decimal value that is multiplied with the alpha transparency channel value.

Default Value:
  • 1

alphaOffset number

アルファ透明度チャンネル値に alphaMultiplier 値を乗算した後に加算する数値です。
数値の範囲は -255 ~ 255 です。
A number from -255 to 255 that is added to the alpha transparency channel value after
it has been multiplied by the alphaMultiplier value.

Default Value:
  • 0

blueMultiplier number

青チャンネル値に乗算する 10 進数値です。
A decimal value that is multiplied with the blue channel value.

Default Value:
  • 1

blueOffset number

青チャンネル値に blueMultiplier 値を乗算した後に加算する数値です。
数値の範囲は -255 ~ 255 です。
A number from -255 to 255 that is added to the blue channel value after
it has been multiplied by the blueMultiplier value.

Default Value:
  • 0

greenMultiplier number

緑チャンネル値に乗算する 10 進数値です。
A decimal value that is multiplied with the green channel value.

Default Value:
  • 1

greenOffset number

緑チャンネル値に greenMultiplier 値を乗算した後に加算する数値です。
数値の範囲は -255 ~ 255 です。
A number from -255 to 255 that is added to the green channel value after
it has been multiplied by the greenMultiplier value.

Default Value:
  • 0

namespace string constant

指定されたオブジェクトの空間名を返します。
Returns the space name of the specified object.

Default Value:
  • next2d.geom.ColorTransform

redMultiplier number

赤チャンネル値に乗算する 10 進数値です。
A decimal value that is multiplied with the red channel value.

Default Value:
  • 1

redOffset number

赤チャンネル値に redMultiplier 値を乗算した後に加算する数値です。
数値の範囲は -255 ~ 255 です。
A number from -255 to 255 that is added to the red channel value after
it has been multiplied by the redMultiplier value.

Default Value:
  • 0

Methods

next2d.geom.ColorTransform.toString ()string static

指定されたクラスのストリングを返します。
Returns the string representation of the specified class.

Default Value:
  • [class ColorTransform]
Returns:
TypeDescription
string

concat (second)void

2 番目のパラメーターで指定された ColorTransform オブジェクトと
現在の ColorTransform オブジェクトを連結し
2 つのカラー変換を加算的に組み合わせた結果を現在のオブジェクトに設定します。
Concatenates the ColorTransform object specified
by the second parameter with the current ColorTransform object
and sets the current object as the result,
which is an additive combination of the two color transformations.

NameTypeDescription
secondColorTransform

ColorTransformオブジェクト

Returns:
TypeDescription
void

toString ()string

指定されたオブジェクトのストリングを返します。
Returns the string representation of the specified object.

Returns:
TypeDescription
string