repeatInstances

Many copies of the layer inside, laid out and varied as the recipe says.

repeatInstances(recipe: RepeatInstancesRecipe): (params: GpuFragmentParams) => Expr

Import effects from shaders/std and use effects.instances.repeatInstances.

Returns the fragment for gpu.fragment on a definition with requiresRTT, requiresChild and wantsBoundsParams set. Copies stack with normal alpha in the recipe's order. The result is straight alpha.

Parameters

NameTypeNotes
recipeRepeatInstancesRecipe

Example

gpu: {fragment: repeatInstances({source: {crop: {left: p('cropLeft'), right: p('cropRight'), top: p('cropTop'), bottom: p('cropBottom')}}, placement: radial({count: p('count'), radius: p('radius'), startAngle: p('startAngle'), sweep: p('sweep'), faceCenter: p('faceCenter')}), variation: {scale: p('instanceScale'), rotation: p('instanceRotation'), opacity: p('instanceOpacity'), jitter: {position: p('jitterPosition'), rotation: p('jitterRotation'), scale: p('jitterScale'), opacity: p('jitterOpacity')}, seed: p('seed'), phase: p('phase')}, hueShift: p('hueShift'), order: p('zOrder')})}

Tip. hueShift costs nothing at 0. Give the prop recompile: crosses(0) so it switches on cleanly.

See also

  • grid — Copies in rows and columns, filling this layer's bounding box.
  • radial — Copies around a circle centred on the layer inside.
  • line — Copies in a row, marching away from the layer inside in one direction.
  • byMode — Lets one select prop switch between a grid, a radial and a linear layout.

Used by

Repeater