Menu

Animated flows (preview)

Two arrow classes loop for as long as the diagram is shown: .pulse sends one glowing dot from the source to the head, .flow streams dashes along the line. They show where requests and events go, at a glance.

{"skemo":1,"name":"motion.skemo","source":"//- Arrows in motion: a dot per request, dashes for a stream\ndiagram(dir=\"right\")\n\n card#phone.client(icon=\"smartphone\") Mobile app\n to(gateway).pulse requests\n\n card#gateway.svc(icon=\"shield\") API gateway\n to(orders).pulse\n to(stock).pulse\n\n card#orders.svc Orders\n to(kafka).flow.orders events\n card#stock.svc Stock\n\n card#kafka.store(icon=\"activity\") Event stream\n","css":[{"name":"motion.css","content":".client { --c: #7048E8; }\n.svc { --c: #3E6FC4; --label: \"Service\"; }\n.store { --c: #B45309; --label: \"Kafka\"; }\n.edge.orders { color: #E8590C; --flow-speed: 40px; }\n"}],"theme":"light"}Mobile appSERVICEAPI gatewaySERVICEOrdersSERVICEStockKAFKAEvent streamrequestsevents
{"skemo":1,"name":"motion.skemo","source":"//- Arrows in motion: a dot per request, dashes for a stream\ndiagram(dir=\"right\")\n\n card#phone.client(icon=\"smartphone\") Mobile app\n to(gateway).pulse requests\n\n card#gateway.svc(icon=\"shield\") API gateway\n to(orders).pulse\n to(stock).pulse\n\n card#orders.svc Orders\n to(kafka).flow.orders events\n card#stock.svc Stock\n\n card#kafka.store(icon=\"activity\") Event stream\n","css":[{"name":"motion.css","content":".client { --c: #7048E8; }\n.svc { --c: #3E6FC4; --label: \"Service\"; }\n.store { --c: #B45309; --label: \"Kafka\"; }\n.edge.orders { color: #E8590C; --flow-speed: 40px; }\n"}],"theme":"dark"}Mobile appSERVICEAPI gatewaySERVICEOrdersSERVICEStockKAFKAEvent streamrequestsevents
motion.skemo
//- Arrows in motion: a dot per request, dashes for a stream
diagram(dir="right")

  card#phone.client(icon="smartphone") Mobile app
    to(gateway).pulse requests

  card#gateway.svc(icon="shield") API gateway
    to(orders).pulse
    to(stock).pulse

  card#orders.svc Orders
    to(kafka).flow.orders events
  card#stock.svc Stock

  card#kafka.store(icon="activity") Event stream
motion.css
.client { --c: #7048E8; }
.svc    { --c: #3E6FC4; --label: "Service"; }
.store  { --c: #B45309; --label: "Kafka"; }
.edge.orders { color: #E8590C; --flow-speed: 40px; }

The diagram above moves in your browser; it is the SVG output with --motion.

How it is written

  • to(gateway).pulse requests: one dot per arrow at any time. Every dot runs at the same speed, so the dots of all arrows leave together and a long arrow takes longer.
  • to(kafka).flow events: dashes moving towards the head, for a continuous stream.
  • Settings are CSS properties on the arrow's class:
.edge.orders { --pulse-color: #E8590C; --pulse-size: 7px; --pulse-speed: 200px; }
.edge.flow   { --flow-speed: 30px; }   /* px per second */

Where it plays

OutputMotion
HTML (-o f.html)plays; stopped for readers who ask their system for less motion
SVG with --motionplays, also inside an <img> tag (CSS animation, no script)
GIF, APNG, animated WebPone loop, frame by frame; APNG keeps the glow's colours best
PNG, WebP, SVG without --motionstill: the arrows are drawn as plain solid lines

Motion and steps combine: a diagram that unfolds step by step can have pulsing arrows at every step (Step-by-step animations).

See also