BRiCKBOX

brickbox Playground

Playground

Every option, live

Drag, hover and press the box, then copy the code for exactly what you see. See every prop.

Shape and angle
24px

How far the box extends back.

x 14°, y 22°

Resting angle. Positive x shows the bottom wall, negative x the top. Positive y shows the right wall, negative y the left.

x
y
60°

Largest angle hover and drag can reach.

1000px

Camera distance. Lower looks more dramatic.

Motion
hover

How the box reacts to the pointer. "both" tilts on hover until you grab it, drag takes over while held, then hover resumes. On touch screens "hover" and "both" behave like drag. "static" adds no tilt listeners.

false

Flip the hover tilt direction, so the box leans away from the pointer instead of toward it.

false

Flip the drag direction. Needs control "drag" or "both".

true

Return to the resting tilt after release or when the pointer leaves.

700 ms

Length of the return animation.

unset (no press)

How far the face sinks when pressed, as a percent of depth. Above 99 counts as 99. Unset or 0 means no press.

150 ms

How fast the press happens. Only matters when pressSink is set.

Look
match

"match" follows the element’s background (a solid colour, or a single linear gradient continued around the edge). A colour is used exactly as given. "none" (or "transparent") builds no walls at all.

auto

Lighting on the walls.

top-left

Where the light comes from. 315 is top-left.

none

A soft shadow of the real silhouette, holes included. "followLight" casts it away from light, "bottom" straight down. Blur and spread are in px. What you leave out comes from depth, and the distance always does.

none

Thin lines on the back rim and on sharp corners. "auto" is a darker line.

1 px

Width of the edge lines.

Touch and state
true

Touch only. true lets vertical swipes scroll the page and only horizontal drags tilt. false lets both axes tilt, but a swipe starting on the box no longer scrolls the page.

none

Areas inside the element that ignore hover, drag and press, like a knob. Elements with a data-brickbox-ignore attribute are ignored too. Tick the box to add a demo knob.

false

Render the element normally with no 3D.

Nesting
unset

Makes this box a part standing on its parent brickbox. Its base sits lift above the parent’s face (0 sits on it), and its depth is its height. Tick the box to add a demo part.

Advanced
0.25 px

How closely curved walls follow the true curve. Lower is smoother and heavier.

true

Re-colours the walls when the face’s colour or shape changes (hover, class, theme, transitions). Turn it off to save work, and call update() yourself after a change.

Demo only: not brickbox props