Garry's Mod Wiki

DColorCube:TranslateValues

number, number DColorCube:TranslateValues( number x, number y )

Description

This is used internally - although you're able to use it you probably shouldn't.

Updates the color cube RGB based on the given x and y position and returns its arguments. Similar to DColorCube:UpdateColor.

Arguments

1 number x
The x position to sample color from/the percentage of saturation to remove from the color (ranges from 0.0 to 1.0).
2 number y
The y position to sample color from/the percentage of brightness or value to remove from the color (ranges from 0.0 to 1.0).

Returns

1 number
The given x position.
2 number
The given y position.

Example

Creates a green color cube and prints out the color at the (0.2, 0.4) position.

local color_cube = vgui.Create("DColorCube") color_cube:SetSize(200, 200) color_cube:Center() -- Set base color to green color_cube:SetColor(Color(0, 255, 0)) -- 20% desaturated, 40% darker color_cube:TranslateValues(0.2, 0.4) -- Get new color local new_color = color_cube:GetRGB() -- Update slider position color_cube:SetColor(new_color) -- Print out new color print("Color( "..new_color.r..", "..new_color.g..", "..new_color.b..", "..new_color.a.." )")
Output:
Color( 30, 153, 30, 255 )

Page Links


Special Pages


Wikis

?

Render Time: 40ms

DB GetPage 2
Generate Html 9
SaveChanges (1) 8
Render Body 0
Render Sidebar 13