Class VisualsKt

  • All Implemented Interfaces:

    
    public final class VisualsKt
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static <S extends Drawable> S withHoverStates(S $self)
      final static <S extends Drawable> S withHoverStates(S $self, Boolean consume, Boolean showClicker, Function0<Animation> animation)
      final static <S extends Drawable> S withCursor(S $self, Cursor cursor)
      final static <S extends Block> S withBorder(S $self, PolyColor color, Float width)
      final static <S extends Block> S withBorder(S $self, Float width, Function1<Colors, PolyColor> color)
      final static <S extends Drawable> S fade(S $self, Boolean in, Long durationNanos) Fade this drawable in or out, with a given duration.
      final static <S extends Drawable> S fadeIn(S $self, Long durationNanos) Alias for fade.
      final static <S extends Drawable> S fadeOut(S $self, Long durationNanos) Alias for fade.
      final static <S extends Component> S shake(S $self)
      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.

      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.
      final static <S extends Drawable> S setPalette(S $self, Colors.Palette palette, Boolean animation)
      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.
      final static <S extends Text> S secondary(S $self)
      final static <S extends Drawable> S setDestructivePalette(S $self)
      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.
      final static <S extends Block> S radius(S $self, Float radius)
      final static <S extends Block> S radii(S $self, FloatArray radii)
      final static <S extends Block> S radii(S $self, Float topLeftRadius, Float topRightRadius, Float bottomLeftRadius, Float bottomRightRadius)
      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.
      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.
      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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • 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

      • fadeIn

         final static <S extends Drawable> S fadeIn(S $self, Long durationNanos)

        Alias for fade.

      • fadeOut

         final static <S extends Drawable> S fadeOut(S $self, Long durationNanos)

        Alias for fade.

      • 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, Function1<Colors, Colors.Palette> palette)

        Set the color palette of this drawable during initialization, using the PolyUI colors instance.

      • 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, 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