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
    Background Nonebackground 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
    ImageSize Automaticthe overall image size for the displayed object
  • With the default option setting ImageSize->Automatic, Overlay leaves space only for the expri currently being displayed.
  • With the 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.
  • 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  (5)

Alignment  (1)

Align objects:

Background  (1)

Set the background:

BaseStyle  (1)

Set the base style of an Overlay:

ImageSize  (2)

By default, Overlay allocates room for all visible objects:

Allocate room for all objects regardless of visibility:

Set the overlay to a specific size in points:

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  (2)

Expressions in front may completely obscure expressions behind them:

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

Overlay prevents tooltips not in the active layer from firing:

Use the third argument to specify the layer where tooltips should be active:

Neat Examples  (2)

Use Overlay to make a fading transition effect:

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

Wolfram Research (2010), Overlay, Wolfram Language function, https://reference.wolfram.com/language/ref/Overlay.html.

Text

Wolfram Research (2010), Overlay, Wolfram Language function, https://reference.wolfram.com/language/ref/Overlay.html.

CMS

Wolfram Language. 2010. "Overlay." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Overlay.html.

APA

Wolfram Language. (2010). Overlay. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Overlay.html

BibTeX

@misc{reference.wolfram_2024_overlay, author="Wolfram Research", title="{Overlay}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/Overlay.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_overlay, organization={Wolfram Research}, title={Overlay}, year={2010}, url={https://reference.wolfram.com/language/ref/Overlay.html}, note=[Accessed: 22-November-2024 ]}