1. Reference
  2. Media

<layer>

Declares one layer of a drawing surface: a locked picture to trace over, and a layer to paint on.

Media
layer.ham
<draw id="canvas"
      layer="paint"
      toolbar="false"
      style="w-full aspect-4/3 rounded-xl">
    <layer id="photo"
           name="Photo"
           src="https://hypeapps.dev/gallery/assets/landscape.jpg"
           locked="true"
           opacity="0.5"/>
    <layer id="paint"
           name="Paint"/>
</draw>
The snippet drawn by Hype Apps on a phone, in light mode The snippet drawn by Hype Apps on a phone, in dark mode
This snippet as Hype Apps draws it on a phone. It follows this page's light or dark theme.

Attributes

NameWhat it doesDefault
blend How the layer composites over the ones below.
normal, multiply, screen, overlay, darken, lighten, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color, luminosity, add
normal
id The layer's id: #id.layer:paint, #id.layer.paint.hide, $id.layer.paint.visible, $id.layer_id; a word, never all digits (that is a layer number).
string
locked Takes no stroke, eraser or fill and cannot be the active layer (a fill still sees it).
boolean
false
name The layer's name as shown ($id.layer_name, $id.layer.paint.name); the id when there is none. With no id, the name serves as the id.
string
opacity Layer opacity 0–1.
number
1
position Place the layer at the top or the bottom of the stack regardless of where it is written.
top, bottom
src Image loaded into the layer as its base (line art, a photo); exported with the drawing.
url
visible false starts the layer hidden.
boolean
true

Any tag also takes gestures: @on.tap, @on.longpress, @on.doubletap and @on.swipeleft (and right, up and down). @click runs on a tap too.

This page is also Markdown, and all of HAM is in llms.txt.