isoCubeFaces

Tumbling blocks: three shaded rhombus faces per hexagon that read as a field of 3D cubes.

isoCubeFaces(slots: {
    frame: PatternPaint
    thickness: PropRef
    softness: PropRef
}): {random: PatternPaint; tone: PatternPaint; wire: PatternPaint}

Import patterns from shaders/std and use patterns.isoCubeFaces.

Returns three values. tone is the face shading (1 on top, 0.74 on the right, 0.5 on the left) to multiply into the cube color. random is a 0–1 value per cube for varying cube colors. wire is the edge-line mask (1 on an edge). thickness 1 draws edges about 4% of a cell wide; 0 draws none. softness 0–1 blurs them. Draw it in a 'clockwise' cellFrame.

Parameters

NameTypeNotes
slots`{
frame: PatternPaint
thickness: PropRef
softness: PropRef

}` | |

Example

const faces = isoCubeFaces({frame: cellFrame({cells: p('cells'), rotation: p('rotation'), convention: 'clockwise'}), thickness: p('thickness'), softness: p('softness')})
// paint: opaque(mixOf(times(rgbOf(cubeColor), faces.tone), rgbOf(p('lineColor')), faces.wire))

See also

  • cellFrame — The shared coordinate system of a tiled pattern: how many cells fit down the canvas height and how far the whole lattice is rotated.
  • hexLines — Honeycomb lines (pointy-top hexagons) drawn in a cellFrame, plus a per-cell shade.
  • times — The product of two values: a mask scaled by a prop, an RGB dimmed by a shade, two masks combined.
  • opaque — An RGB value finished as a fully opaque color.

Used by

IsometricCubes