Skip to content

module

scene_classes

Tailwind classes on 3D objects: the utilities that mean something for an object, plain or under hover:, active: (pressed) and focus: (its keyboard proxy focused).

mesh(class: "fill-sky-500 transition duration-300 hover:scale-110 hover:fill-pink-500 active:scale-95")
ClassEffect
fill-{colour}, bg-{colour}, fill-[#hex]colour
opacity-{0–100}, opacity-[0.4]opacity
scale-{n} (percent), scale-x/y/z-{n}, scale-[1.3]scale (× its own)
rotate-{deg} (about z), rotate-x/y/z-{deg}, -rotate-…rotation (added)
translate-x/y/z-{n} (0.25 units a step), -translate-…, translate-y-[0.3]offset (added)
brightness-{n} (over 100 glows)emissive
transition, duration-{ms}how long changes take

Structs

  • Interaction

    Which object is hovered, pressed and focused.

  • Look

    What one set of classes does to an object.

  • ObjectClasses

    An object's classes: its own look and how it changes.

Functions

apply

pub fn apply(obj: &mut Object3D, look: &Look)

Apply look to obj (scale multiplies, rotation and offset add).

parse

pub fn parse(class: &str) -> ObjectClasses

Read an object's class.

set_theme

pub fn set_theme(theme: Theme)

Use theme's colours for scene classes.

styled

pub fn styled(objects: &[Object3D], classes: &[ObjectClasses], state: Interaction) -> Vec<Object3D>

objects (as built, base looks applied) with each one's hover:, active: and focus: looks for state.