Class VisualsKt
-
- All Implemented Interfaces:
public final class VisualsKt
-
-
Method Summary
Modifier and Type Method Description final static <S extends Drawable> SwithHoverStates(S $self)final static <S extends Drawable> SwithHoverStates(S $self, Boolean consume, Boolean showClicker, Function0<Animation> animation)final static <S extends Drawable> SwithCursor(S $self, Cursor cursor)final static <S extends Block> SwithBorder(S $self, PolyColor color, Float width)final static <S extends Block> SwithBorder(S $self, Float width, Function1<Colors, PolyColor> color)final static <S extends Drawable> Sfade(S $self, Boolean in, Long durationNanos)Fade this drawable in or out, with a given duration. final static <S extends Drawable> SfadeIn(S $self, Long durationNanos)Alias for fade. final static <S extends Drawable> SfadeOut(S $self, Long durationNanos)Alias for fade. final static <S extends Component> Sshake(S $self)final static <S extends Drawable> Stoggleable(S $self, Boolean default)Make this drawable toggleable, meaning that, when clicked: it will change its palette to the brand foreground color if it is toggled on, and to the component background color if it is toggled off.
it will emit a Event.Change.State event. you can use the onToggle function to easily listen to this event.
final static <S extends Drawable> SsetState(S $self, Byte state)Set the palette of this drawable according to one of the three possible component states in PolyUI. final static <S extends Drawable> SsetPalette(S $self, Colors.Palette palette, Boolean animation)final static <S extends Drawable> SsetPalette(S $self, Function1<Colors, Colors.Palette> palette)Set the color palette of this drawable during initialization, using the PolyUI colors instance. final static <S extends Text> Ssecondary(S $self)final static <S extends Drawable> SsetDestructivePalette(S $self)final static <S extends Text> SsetFont(S $self, Function1<FontFamily, Font> font)Set the font of this text component during initialization, using the PolyUI fonts instance. final static <S extends Block> Sradius(S $self, Float radius)final static <S extends Block> Sradii(S $self, FloatArray radii)final static <S extends Block> Sradii(S $self, Float topLeftRadius, Float topRightRadius, Float bottomLeftRadius, Float bottomRightRadius)final static <S extends Drawable> Sadd3dEffect(S $self, Double xIntensity, Double yIntensity)Add a 3D hover effect to the specified drawable which slightly skews the object as the mouse moves across it, giving the appearance of it popping off the screen. final static <T extends Inputtable> TaddRethemingListeners(T $self)Use this method on your component if you plan on it being removed from the component tree and re-added later, to guard against the theming system not updating the component's palette as it was not referenced when the colors were changed. final static <T extends Inputtable> TaddRescalingListeners(T $self, Boolean withChildren)Use this method on your component if you plan on it being removed from the component tree and re-added later, to guard against the rescaling system not updating the component's size (and optionally its children) as it was not referenced anywhere when the size was changed. final static Componentretheme(Component $self, Colors old, Colors new, Boolean animate)Perform a retheme operation on this component, changing its palette from the old Colors to the new Colors, and all its children. final static Componentrefont(Component $self, FontFamily old, FontFamily new)Perform a refont operation on this component, changing its font from the old FontFamily to the new FontFamily, and all its children. -
-
Method Detail
-
withHoverStates
final static <S extends Drawable> S withHoverStates(S $self)
-
withHoverStates
final static <S extends Drawable> S withHoverStates(S $self, Boolean consume, Boolean showClicker, Function0<Animation> animation)
-
withCursor
final static <S extends Drawable> S withCursor(S $self, Cursor cursor)
-
withBorder
final static <S extends Block> S withBorder(S $self, PolyColor color, Float width)
-
withBorder
final static <S extends Block> S withBorder(S $self, Float width, Function1<Colors, PolyColor> color)
-
fade
final static <S extends Drawable> S fade(S $self, Boolean in, Long durationNanos)
Fade this drawable in or out, with a given duration.
If it is not initialized, it applies the fade instantly.
- Since:
1.5.0
-
toggleable
final static <S extends Drawable> S toggleable(S $self, Boolean default)
Make this drawable toggleable, meaning that, when clicked:
it will change its palette to the brand foreground color if it is toggled on, and to the component background color if it is toggled off.
it will emit a Event.Change.State event. you can use the onToggle function to easily listen to this event.
- Since:
1.5.0
-
setState
final static <S extends Drawable> S setState(S $self, Byte state)
Set the palette of this drawable according to one of the three possible component states in PolyUI.
- Parameters:
state- the state to set.
-
setPalette
final static <S extends Drawable> S setPalette(S $self, Colors.Palette palette, Boolean animation)
-
setPalette
final static <S extends Drawable> S setPalette(S $self, Function1<Colors, Colors.Palette> palette)
Set the color palette of this drawable during initialization, using the PolyUI colors instance.
-
setDestructivePalette
final static <S extends Drawable> S setDestructivePalette(S $self)
-
setFont
final static <S extends Text> S setFont(S $self, Function1<FontFamily, Font> font)
Set the font of this text component during initialization, using the PolyUI fonts instance.
- Since:
1.1.3
-
radii
final static <S extends Block> S radii(S $self, FloatArray radii)
-
radii
final static <S extends Block> S radii(S $self, Float topLeftRadius, Float topRightRadius, Float bottomLeftRadius, Float bottomRightRadius)
-
add3dEffect
final static <S extends Drawable> S add3dEffect(S $self, Double xIntensity, Double yIntensity)
Add a 3D hover effect to the specified drawable which slightly skews the object as the mouse moves across it, giving the appearance of it popping off the screen.
- Since:
1.6.01
-
addRethemingListeners
final static <T extends Inputtable> T addRethemingListeners(T $self)
Use this method on your component if you plan on it being removed from the component tree and re-added later, to guard against the theming system not updating the component's palette as it was not referenced when the colors were changed.
Why is this behavior not default? Because it is quite an unlikely scenario that a component will be removed and re-added, and having this run unnecessarily introduces a performance overhead.
- Since:
1.8.3
-
addRescalingListeners
final static <T extends Inputtable> T addRescalingListeners(T $self, Boolean withChildren)
Use this method on your component if you plan on it being removed from the component tree and re-added later, to guard against the rescaling system not updating the component's size (and optionally its children) as it was not referenced anywhere when the size was changed.
Why is this behavior not default? Because it is quite an unlikely scenario that a component will be removed and re-added, and having this run unnecessarily introduces a performance overhead.
- Since:
1.9.6
-
retheme
final static Component retheme(Component $self, Colors old, Colors new, Boolean animate)
Perform a retheme operation on this component, changing its palette from the old Colors to the new Colors, and all its children.
- Since:
1.8.3
-
refont
final static Component refont(Component $self, FontFamily old, FontFamily new)
Perform a refont operation on this component, changing its font from the old FontFamily to the new FontFamily, and all its children.
- Since:
1.8.3
-
-
-