Overlay

Overlay[{expr1,expr2,}]

displays as an overlay of all the expri.

Overlay[{expr1,expr2,},{i,j,}]

displays as an overlay of expri, exprj, .

Overlay[{expr1,expr2,},{i,j,},s]

allows selections to be made and controls to be clicked in exprs.

Details and Options

  • The expri can be graphics, text, or any other expressions.
  • In Overlay[{expr1,expr2,}] the later expri are rendered on top of earlier ones.
  • Overlay[exprs] is equivalent to Overlay[exprs,All,None] and displays as an overlay of all the exprs.
  • Overlay[exprs] by default allows no selection within the exprs.
  • The following options can be given:
  • Alignment{Automatic,Automatic}how to align objects in the display area
    BackgroundNonebackground color to use
    BaselinePositionAutomaticwhat to align with a surrounding text baseline
    BaseStyle{}base style specifications for the displayed object
    ContentPaddingTruewhether to shrink the margins tightly around the contents
    FrameMarginsAutomaticmargins to leave inside the overall frame
    ImageMargins0margins around the image of the displayed object
    ImageSizeAllthe overall image size for the displayed object
  • With the default option setting ImageSize->All, Overlay always leaves space for the largest of the expri to be displayed, so that its overall size does not change.
  • With the option setting ImageSize->Automatic, Overlay leaves space only for the expri currently being displayed.
  • The settings for BaseStyle are appended to the default style given by the "Overlay" style in the current stylesheet.

Examples

open allclose all

Basic Examples  (2)

Overlay two expressions:

Overlay two graphics:

Scope  (5)

Overlay many objects:

Overlay two-dimensional and three-dimensional graphics:

Overlay text and graphics:

Use a nondefault ordering:

Allow clicks in the back layer:

Generalizations & Extensions  (1)

Overlay with a single element is similar in behavior to a PaneSelector:

Options  (3)

Alignment  (1)

Align objects:

Background  (1)

Set the background:

BaseStyle  (1)

Set the base style of an Overlay:

Applications  (3)

Make a new character from existing characters:

Watermark an output:

Create an image map using invisible controls overlaid onto an image:

The controls create a photorealistic, fully functional numeric keypad:

Possible Issues  (1)

Expressions in front may completely obscure expressions behind them:

Using transparency or removing background colors might achieve the desired appearance:

Neat Examples  (2)

Use Overlay to make a fading transition effect:

Create a decorative frame for a 3D object which can still be rotated:

Introduced in 2010
 (8.0)