Node / Images Shapes · guide
Layer styling — rotation, opacity, blur, clip, box fill
Current Apexify.js 6.0.0 documentation for Layer styling — rotation, opacity, blur, clip, box fill.
These fields apply to both bitmaps and shapes unless noted.
Transform & atmosphere
| Field | Type | What it does |
|---|---|---|
rotation | number (degrees) | Rotates around the centre of the layout box (x + width/2, y + height/2). |
opacity | number (0…1) | globalAlpha while drawing bitmap pixels / vector fill. |
blur | number (px) | Canvas filter: blur(...) during the raster/shape paint phase. |
blendMode | GlobalCompositeOperation | Porter–Duff compositing vs pixels already on the canvas (multiply, screen, …). |
Rounded rectangle clip — borderRadius
Controls how drawImageBitmap (and drawShape) builds the clip path unless you supply clipPath.
| Value | Behaviour |
|---|---|
0 / omitted | Sharp rectangle matching width × height. |
number > 0 | Corner radius in pixels. Internally clamped so arcs never overlap: radius ≤ min(width, height) / 2. |
'circular' | Ignores numeric radius and clips to the circle inscribed in the box (diameter = min(width, height)). borderPosition is ignored in this mode — every corner is rounded equally into one circle. |
The shadow (shadow) for bitmaps is painted before this clip, so you still see a soft halo outside rounded thumbs — desirable for UI cards.
Corner selection — borderPosition
Strings are case-insensitive and may list multiple corners separated by commas.
Tokens understood by computeCornerRadii:
| Token | Meaning |
|---|---|
all | Every corner uses the computed radius (default). |
top, right, bottom, left | Enables both corners touching that edge (e.g. top ⇒ top-left + top-right). |
top-left, top-right, bottom-right, bottom-left | Single corner only. |
Examples:
borderPosition: 'bottom'— floor-card look (only bottom corners rounded).borderPosition: 'top-left, bottom-right'— diagonal styling withborderRadius: 24.- Omit
borderPosition→ behaves likeall.
Shapes reuse the same helper for borderRadius clipping around their layout box before drawShape runs — the vector geometry itself stays sharp unless you approximate with filters.
Polygon clip — clipPath
clipPath is { x, y }[] with ≥ 3 vertices in canvas space. When present it replaces the rounded-rect clip entirely (Bitmap pipeline only — shape layers ignore clipPath today).
Fewer than three points throws Clip path must have at least 3 points.
Behind the pixels — boxBackground
boxBackground?: { color?: string; gradient?: gradient }
Rendered after shadow, before clipping. Visible wherever the bitmap does not fully cover the layout box (letterboxing under contain) or when opacity exposes the plate.
Pipeline cheat sheet (bitmaps)
- Rotation → shadow plate →
boxBackground - Clip (
clipPathorborderRadiuspath) - Draw masked/distorted bitmap (see other chapters)
Shapes skip clipPath but otherwise mirror borderRadius clipping around width × height.