webdevpuneet.com

Scroll Receipt Printer: GSAP Itemized Bill Animation

Scroll Receipt Printer: GSAP Itemized Bill Animation · Scroll · Plain HTML, CSS & JS · Live preview

Copy & paste

Source Code

<section class="rc-stage" id="rcStage">
  <div class="rc-copy">
    <p class="rc-kicker">Itemized pricing</p>
    <h1>Every line, printed as you scroll</h1>
    <p>A thermal printer feeds the receipt out one step at a time, so a long price breakdown reads like it is being handed over.</p>
  </div>
  <div class="rc-machine">
    <div class="rc-window">
      <div class="rc-paper" id="rcPaper">
        <p class="rc-shop">PIXEL &amp; PINE STUDIO</p>
        <p class="rc-meta">Project receipt #4821 &middot; 18 Nov</p>
        <ul class="rc-lines">
          <li><span>Brand sprint</span><b>1,200.00</b></li>
          <li><span>Logo suite</span><b>640.00</b></li>
          <li><span>Landing page</span><b>1,800.00</b></li>
          <li><span>CMS setup</span><b>450.00</b></li>
          <li><span>Copy edit</span><b>220.00</b></li>
          <li><span>Stock photos</span><b>90.00</b></li>
        </ul>
        <div class="rc-sum"><span>Subtotal</span><b>4,400.00</b></div>
        <div class="rc-sum"><span>Tax 8%</span><b>352.00</b></div>
        <div class="rc-sum rc-total"><span>TOTAL</span><b>4,752.00</b></div>
        <div class="rc-bar" aria-hidden="true"></div>
        <p class="rc-thanks">Thank you. Keep this receipt.</p>
        <span class="rc-stamp" id="rcStamp">PAID</span>
      </div>
    </div>
    <div class="rc-printer"><span class="rc-slot"></span><i class="rc-led"></i><b>PRINT-80</b></div>
  </div>
</section>
<section class="rc-after"><p>Receipt done. The page carries on.</p></section>

Extend with AI

Take This Snippet Further With AI

Paste this snippet into an AI coding assistant and ask it to explain how a hidden-overflow window, a raised printer body and a stepped ease combine to make paper look like it is printing. Useful follow-ups: a version where the total counts up as it prints, a landscape receipt that prints sideways, or a "tear off" interaction that lets the user click the paper to remove it. Ask it to keep reduced-motion support.

Prompt to recreate it

Copy this into your AI assistant of choice to build the effect from scratch, or as a jumping-off point for your own variant:

text
Build a "scroll receipt printer" in plain HTML, CSS and JavaScript using GSAP with ScrollTrigger (from a CDN).

Requirements:
- A full-viewport pinned stage with a heading and short paragraph on the left and a printer on the right (stacked on screens under 760px).
- The printer is a dark rounded body with a slot, a blinking green LED and a label. Above it is a window with overflow hidden that contains the paper. The printer body sits over the window with a higher z-index so the paper appears to come out of the slot.
- The paper is a cream block in a monospace font: shop name, receipt number and date, six line items with right-aligned prices, subtotal, tax and a bold total, a CSS barcode and a thank-you line. Cut the zigzag top edge with a CSS mask (conic-gradient plus linear-gradient).
- One GSAP timeline: tween the paper from yPercent 100 to 0 with ease steps(28), then at the end scale a red PAID stamp in with a back ease.
- Attach the timeline with ScrollTrigger (pin: true, scrub about 0.3, end: '+=1800') so scrolling back up pulls the receipt back in.
- If prefers-reduced-motion is set, set the timeline to its end and skip the pin.

Want to tighten it up first? Run this prompt through the AI Prompt Studio to score it across 8 quality dimensions, catch anti-patterns, and tune the wording for Claude, ChatGPT, or Gemini before you paste it in.

What's included

Features

Stepped paper feed
ease steps(28) advances the paper in jerks like a real thermal printer.
Clipped by the slot
A hidden-overflow window and a raised printer body make paper emerge from the machine.
Torn zigzag edge
A CSS conic-gradient mask cuts the teeth, so no image is needed.
CSS barcode
A repeating-linear-gradient draws the barcode strip in one rule.
PAID stamp timing
The stamp sits on the same timeline and lands after the final line.
Pinned and reversible
Scrolling up reels the receipt back into the printer.
Real text content
Every line is selectable HTML in reading order, not an image.
Reduced-motion safe
The finished receipt shows at once when motion is reduced.

About this UI Snippet

Scroll Receipt Printer: An Itemized Bill That Prints as You Scroll

Screenshot of the Scroll Receipt Printer: GSAP Itemized Bill Animation snippet rendered live

A price breakdown is easy to skim past. This snippet turns it into a small event: a thermal printer sits at the bottom of a pinned stage, and as you scroll, a paper receipt feeds up out of the slot one jerk at a time. The shop name appears first, then each line item, the subtotal, tax and total, a barcode, and finally a red PAID stamp.

The paper moves, nothing else does

The whole receipt is one block. A single GSAP tween moves it from yPercent: 100 (hidden below the slot) to 0. A window with overflow: hidden clips whatever has not left the slot yet, and the printer body sits above it with a higher z-index, so the paper really appears to come out of the machine.

Stepped easing gives the mechanical feel

The tween uses ease: 'steps(28)'. Instead of sliding smoothly, the paper advances in 28 small increments across the scroll range. It is the detail that makes the result read as a printer rather than a generic reveal.

A pinned, scrubbed timeline

A ScrollTrigger.create() call pins the stage for +=1800 pixels of scrolling and scrubs the timeline with scrub: 0.3. Scrolling back up pulls the receipt back into the slot. The stamp is placed on the same timeline at 0.9, so it lands only when the last line is out.

A torn edge without images

The zigzag top is a CSS mask: a repeating conic-gradient forms the teeth and a linear-gradient fills the rest. There are no image files, and the paper keeps its shape at any width.

Accessibility and responsive layout

The receipt text is real, selectable HTML in the right reading order. With prefers-reduced-motion the timeline jumps to its end and the pin is skipped. Below 760px the copy collapses to a headline so the printer still fits the screen. Change the lines, prices and shop name to match your own offer, or pair it with a scroll stat reveal story for the numbers that follow.

Step by step

How to Use

  1. 1
    Add the GSAP CDNsInclude gsap and ScrollTrigger from the CDN panel.
  2. 2
    Paste HTML, CSS and JSA heading and a printer with a blank slot render on a dark stage.
  3. 3
    Edit the receiptChange the shop, line items, tax and total inside .rc-paper.
  4. 4
    Scroll downThe paper feeds out of the slot in small steps and the PAID stamp lands last.
  5. 5
    Change the paceEdit steps(28) for coarser or finer feed, and end: '+=1800' for scroll length.
  6. 6
    Scroll back upThe receipt is pulled back into the printer.

Real-world uses

Common Use Cases

Pricing breakdowns for services
Show what a project costs line by line, such as design, build and hosting, so the total feels earned rather than announced.
SaaS plan and add-on summaries
Print the base plan, seats and add-ons before the total, so visitors can see exactly where the monthly number comes from.
Year-in-review and impact pages
Turn stats into a receipt of what a customer got this year, then continue into a scroll stat reveal story.
Order confirmation storytelling
Use it on a marketing page that explains what is included in an order, a lighter alternative to a static table.

Got questions?

Frequently Asked Questions

The paper sits inside a container with overflow hidden. It starts translated 100% downward, fully clipped, and moves to 0. The printer body is layered on top with a higher z-index and a small negative margin, so the paper appears to emerge from its slot.

It makes the tween advance in 28 discrete jumps across its duration instead of a smooth slide. Scrubbed against scroll, the paper moves in small mechanical increments. Use a larger number for a finer feed or remove it for a smooth glide.

Yes. The paper's own height is what the tween travels, so adding rows just makes it longer. Keep the receipt within the viewport height, or lower the font size, so the finished receipt is fully visible at the end.

No. It is decorative, drawn with a repeating-linear-gradient. For a scannable barcode or QR code, swap that element for an SVG from a barcode library and keep the same container.