Binding of Isaac - Afterbirth+ Lua Reference/Guide
|
Public Member Functions |
|
Color (float, float, float, float, integer, integer, integer) | |
Reset () | |
SetTint (float RedTint, float GreenTint, float BlueTint, float AlphaTint) | |
SetColorize (float Red, float Green, float Blue, float Amount) | |
SetOffset (float RedOffset, float GreenOffset, float BlueOffset) | |
Color & | __mul (Color right) |
Static Public Member Functions |
|
static Color | Lerp (Color m1, Color m2, float t) |
Public Attributes |
|
float | R |
float | G |
float | B |
float | A |
float | RO |
float | GO |
float | BO |
Color::Color | ( | float | R, |
float | G, | ||
float | B, | ||
float | A, | ||
integer | RO, | ||
integer | GO, | ||
integer | BO | ||
) |
Constructor for the "Color" class.
Notes: You need to use the KColor() constructor when using the Font class.
Colors are made of three separate components, tint, colorize and offset. Tint acts like a color multiplicator. Offset is a color which is added after the tint is applied. Colorize is complicated. See the SetColorize()
function for a detailed description.
R, G, B and A accept numbers between 0 and 1.
RO, GO and BO accept numbers between -255 and 255.
Linear Interpolation between two colors. t
is the "progress" of the interpolation. Setting t = 0.5
means that the color in the middle of m1 and m2 will be returned.
Color::Reset | ( | ) |
Color::SetColorize | ( | float | Red, |
float | Green, | ||
float | Blue, | ||
float | Amount | ||
) |
The colorize function can be used to change the color of sprites. Its the best for that purpose, since it doesnt affect existing coloranimations like the flashing of creep.
The values can be between 0 and 1 for normal coloration. if you use higher numbers the color gets more vibrant.
Colorization is applied after the tint and before the offset function.
SetColorize(1, 1, 1, 1)
will turn the sprite into grayscale.SetColorize(1, 0, 0, 1)
will turn it red but not as a red tint but as shades of red.SetColorize(1, 1, 1, 2)
will invert the sprite without touching its luminosity.Test:AddCallback(ModCallbacks.MC_POST_EFFECT_INIT, function(_, self)
if self.Variant == EffectVariant.CREEP_RED then
local color = Color(1, 1, 1, 1, 0, 0, 0)
color:SetColorize(4, 0, 4, 1)
self:GetSprite().Color = color
end
end)
Color::SetOffset | ( | float | RedOffset, |
float | GreenOffset, | ||
float | BlueOffset | ||
) |
Offset is a color that gets added to the sprite after the Tint was applied.
Color::SetTint | ( | float | RedTint, |
float | GreenTint, | ||
float | BlueTint, | ||
float | AlphaTint | ||
) |
Tint acts like a color multiplicator.
float Color::A |
float Color::B |
float Color::BO |
float Color::G |
float Color::GO |
float Color::R |
float Color::RO |