LayMeshDocs
中文

Draw and reveal extensions#

Animation manual · Steps and actions

Built-in LayMesh keyframes#

laymesh-draw/draw and laymesh-reveal/reveal belong to LayMesh rather than Animate.css. They do not require importing that library. Supply duration and an appropriate fill mode.

Name Behavior
laymesh-draw / draw Progressively show a stroked path
laymesh-reveal / reveal Expand a reveal region
lcss
.draw-motion { animation:laymesh-draw 1200ms ease both; }.reveal-motion { animation:laymesh-reveal 1s ease both; }

Alternatively call s.animate(line_instance,name="laymesh-draw",duration=1s,fill="both"). The target must be placed; a filled shape does not become a stroked path.

Charts and ordinary objects#

Chart reveal clips the data area while retaining axes and legends. Ordinary objects reveal their layout box. This is not data interpolation and does not alter data, axis limits or static geometry.

Full source
timing.lay
page = canvas(size=(120mm,65mm), stylesheet="@laymesh/animate.css", background="#ffffff")title = page.add(text("Title", font_size=6mm), target=page.top_left, offset=(12mm,8mm))chart = page.add(rect(size=(45mm,25mm), fill="#0d6efd"), target=title.bottom_left, offset=(0mm,9mm))note = page.add(text("Conclusion", font_size=4mm), target=chart.middle_right, anchor=middle_left, offset=(11mm,0mm))first = page.step(name="Title and chart", hold=500ms)first.animate(title, class="animate__animated animate__fadeInUp", duration=600ms)first.animate(chart, name="laymesh-reveal", duration=800ms, fill="both", start="with-previous")first.animate(note, class="animate__animated animate__fadeIn", duration=400ms, start="after-previous", delay=200ms)second = page.step(name="Emphasis", start="after-previous", hold=1s)second.animate(title, class="animate__animated animate__pulse", duration=800ms)

Preview

Background
Preparing animation…
Timing
Preparing preview…
Total —
Details

Not run yet

Measured in this browser; excludes debounce.

Edits stay on this page
Dependencies
  • examples/animation/timing.lay

Custom progress#

Nonstandard -laymesh-draw and -laymesh-reveal properties accept 0–1:

lcss
@keyframes reveal-part {  from { -laymesh-reveal:0; }  to { -laymesh-reveal:1; }}

Reference this definition with animation or name. Progress, duration, delay and fill participate in ordinary animation sampling and scheduling.