Style and motion
JOID ships no theme: an interface looks the way you draw it, from the first color to the last animation. This chapter gives you the tools to build that look and to make it move: colors, effects on nodes, animations and transitions between UIs.
Colors and styling
Section titled “Colors and styling”Every shape takes a Color: a preset, components, a string copied from a design tool, or a gradient.
private static final Color BRAND = Color.decode("#3366CC").lock();Read Colors and styling to learn how to create colors, derive a palette from one color, fill shapes with gradients and keep a palette safe.
Effects
Section titled “Effects”An effect changes how a node is drawn without touching the layout: rounded corners, borders, shadows, blur, masks and transforms.
RectNode.create(150, 100, 300, 180).color(EffectsUI.SURFACE).effect(RoundedNodeEffect.create(24F)).effect(BorderNodeEffect.create(EffectsUI.ACCENT, 2F)).effect(ShadowNodeEffect.create(EffectsUI.ACCENT, 24F).offsetY(8D)).attach(this);Read Effects to learn how to stack effects, drive them with changing values, and predict the order in which JOID applies them.
Animation
Section titled “Animation”JOID animates values on its own clock, and a setter follows the animated value through an expression that reads it.
final TweenAnimator appear = TweenAnimator.create(0F).sequence(600F, 1F, TweenEquations.CUBIC_OUT).start();
RectNode.create(160, 0, 300, 180).color(AnimationUI.ACCENT.withAlpha(appear.get())).y(140D - 60D * appear.get()).attach(this);Read Animation to learn how to choose the right tool, shape the motion with easing, and chain, repeat or replay an animation.
Transitions
Section titled “Transitions”A transition animates a whole UI when it opens and closes; popups play one by default.
public SlidePopupUI() { super.transition(SlideTransition.create());}Read Transitions to learn how to configure the popup transition and write a transition of your own.
