Send an equation phrase's elements back in the equation's draw stack. All
elements within content are moved together as a group, keeping their
current relative draw order. Nested front/back functions are applied
inner-most first, so an inner front/back reorders the elements and this
(outer) function then moves the reordered group as a unit.
The group's position is determined by, in order of precedence:
before - position the group just before (behind) the most-back of the
named anchor element(s). num shifts it further back (default 0).
after - position the group just after (in front of) the most-front of
the named anchor element(s). num shifts it further forward (default 0).
num - a positive value moves the group that many places back; a negative
value positions it |num| places ahead of the very back.
otherwise the group is sent completely to the back.
The reorder is applied whenever the form is shown, relative to the equation's
natural (definition) draw order, so each form deterministically defines its
own stacking.
Options can be an object, or an array in the property order below
// Three overlapping squares, offset so the stacking order is visible. Blue // is defined last so it sits on top by default; `back` sends it behind the // red and green squares (so green ends up on top). constsq = color=>figure.primitives.rectangle({ width:0.6, height:0.6, color }); figure.add({ make:'equation', elements: { r:sq([1, 0, 0, 1]), g:sq([0, 0.8, 0, 1]), b:sq([0, 0, 1, 1]), }, forms: { 0: [ { offset: ['r', [0, 0]] }, { offset: ['g', [0.3, -0.25]] }, { offset: [{ back: ['b'] }, [0.6, -0.5]] }, ], }, });
Example
// Object Definition with an anchor - position the blue square just before // (behind) the red square, so red and green sit on top of it. constsq = color=>figure.primitives.rectangle({ width:0.6, height:0.6, color }); figure.add({ make:'equation', elements: { r:sq([1, 0, 0, 1]), g:sq([0, 0.8, 0, 1]), b:sq([0, 0, 1, 1]), }, forms: { 0: [ { offset: ['r', [0, 0]] }, { offset: ['g', [0.3, -0.25]] }, { offset: [{ back: { content:'b', before:'r' } }, [0.6, -0.5]] }, ], }, });
Equation back function
Send an equation phrase's elements back in the equation's draw stack. All elements within
contentare moved together as a group, keeping their current relative draw order. Nestedfront/backfunctions are applied inner-most first, so an innerfront/backreorders the elements and this (outer) function then moves the reordered group as a unit.The group's position is determined by, in order of precedence:
before- position the group just before (behind) the most-back of the named anchor element(s).numshifts it further back (default0).after- position the group just after (in front of) the most-front of the named anchor element(s).numshifts it further forward (default0).num- a positive value moves the group that many places back; a negative value positions it|num|places ahead of the very back.The reorder is applied whenever the form is shown, relative to the equation's natural (definition) draw order, so each form deterministically defines its own stacking.
Options can be an object, or an array in the property order below
See
To test examples, append them to the boilerplate
Example
Example