Opus Motion ★ Star on GitHub

Documents · receipt-print

Receipt print

A thermal receipt printer feeds paper up out of its slot one line-feed at a time: store header, itemised lines, computed subtotal / tax / total (highlighted), footer and a barcode.

A free, MIT-licensed document animation from the Opus Motion Library — 616 motions for Remotion, React and plain HTML.

Receipt print: three frames of the document animation, start, middle and end
Receipt print — start, middle and end of the 8.0-second motion.

What Receipt print is for

Order confirmations, expense / cost breakdowns, "the bill came to" beats, pricing explainers, shopping and fintech promos.

  • receipt
  • invoice
  • bill
  • order
  • printer
  • ecommerce
  • checkout
  • expenses
  • total
  • document
  • thermal

Details

Category
Document, form & report animations
Length
8.0 s (240 frames at 30 fps)
Formats
16:9, 1:1, 9:16
Weight
light
Transparent overlay
yes
Seamless loop
no
Text props
items
Colour props
background paper ink accent printer
Mood
paper
Roles
subject

Use Receipt print in Remotion, React or HTML

Remotion project

terminal
# copy this motion into your Remotion project
node cli/mgl.mjs add receipt-print --to ../my-app/src

# render an mp4 (run in the library folder)
node cli/mgl.mjs render receipt-print --props '{"items":[{"name":"Flat white","price":4.5,"qty":2},{"name":"Almond croissant","price":3.8},{"name":"Cold brew","price":4.2},{"name":"Avocado toast","price":9.5}],"background":"#E7E2D8","paper":"#FBFAF4","ink":"#24232B","accent":"#E8412A","printer":"#3A3D4A"}'

# or export for apps / editors: mp4 | webm-alpha | prores-alpha | gif | png | poster
node cli/mgl.mjs export receipt-print --as webm-alpha --props '{"items":[{"name":"Flat white","price":4.5,"qty":2},{"name":"Almond croissant","price":3.8},{"name":"Cold brew","price":4.2},{"name":"Avocado toast","price":9.5}],"background":"#E7E2D8","paper":"#FBFAF4","ink":"#24232B","accent":"#E8412A","printer":"#3A3D4A"}'

React / Next.js

tsx
import {MotionPlayer} from 'opus-motion-library/web';

<MotionPlayer
  motion="receipt-print"
  props={{
    items: [
      {name: 'Flat white', price: 4.5, qty: 2},
      {name: 'Almond croissant', price: 3.8},
      {name: 'Cold brew', price: 4.2},
      {name: 'Avocado toast', price: 9.5},
    ],
    background: '#E7E2D8',
    paper: '#FBFAF4',
    ink: '#24232B',
    accent: '#E8412A',
    printer: '#3A3D4A',
  }}
  playOnView
  loop="auto"
/>

Plain HTML / WordPress

html
<script src="opus-motion.element.js" defer></script>

<opus-motion motion="receipt-print"
  props='{"items":[{"name":"Flat white","price":4.5,"qty":2},{"name":"Almond croissant","price":3.8},{"name":"Cold brew","price":4.2},{"name":"Avocado toast","price":9.5}],"background":"#E7E2D8","paper":"#FBFAF4","ink":"#24232B","accent":"#E8412A","printer":"#3A3D4A"}'>
</opus-motion>

Compose spec (multi-scene video)

json
{
  "width": 1920,
  "height": 1080,
  "fps": 30,
  "scenes": [
    {
      "motion": "receipt-print",
      "props": {
        "items": [
          {
            "name": "Flat white",
            "price": 4.5,
            "qty": 2
          },
          {
            "name": "Almond croissant",
            "price": 3.8
          },
          {
            "name": "Cold brew",
            "price": 4.2
          },
          {
            "name": "Avocado toast",
            "price": 9.5
          }
        ],
        "background": "#E7E2D8",
        "paper": "#FBFAF4",
        "ink": "#24232B",
        "accent": "#E8412A",
        "printer": "#3A3D4A"
      }
    }
  ]
}

Receipt print props

17 parameters — change any of them to make the motion yours.

PropDefaultWhat it does
storeName"CORNER CAFE"header line (shop / company)
address"12 Main Street"line under the header
items[{"name":"Flat white","price":4.5,"qty":2},{"name":"Almond croissant","price":3.8},{"na…array of {name, price, qty?}; subtotal, tax and total are computed
currency"$"currency symbol / prefix
taxRate0.08tax fraction (0.08 = 8%, 0 for none)
taxLabel"TAX 8%"label of the tax line
totalLabel"TOTAL"label of the total line
footer"THANK YOU!"line under the total
background"#E7E2D8"backdrop colour or 'transparent'
paper"#FBFAF4"paper colour
ink"#24232B"print colour
accent"#E8412A"total amount / underline / status light colour
printer"#3A3D4A"printer body colour
lineFrames8frames per printed line (lower = faster)
startAt18frame printing starts
subtotalLabel"SUBTOTAL"label of the subtotal line
printingLabel"PRINTING"small status text on the printer body

Notes & credits

Technique sources:

  • original (round 3)