persian-motion-director
Direct and build professional motion design (promo and launch films, kinetic typography, animated explainers, social clips, title sequences) with correct Persian/Farsi and right-to-left typography, in Remotion or plain web code. Use this skill whenever the user wants a video, animation, motion graphics, teaser or animated text that contains Persian, Farsi, Arabic-script or RTL text, and whenever they say a motion piece looks "default", "like a slideshow", "AI-made" or "not pro", or that the Persian looks off, broken or disconnected, even if they never say "motion design". It brings the anti-slideshow method (one camera, objects that carry across scenes, music-first beat-locked edits), eight ready techniques with live sketches, HarfBuzz tooling for per-letter and per-dot Persian animation, kashida stretching, and a Persian correctness checklist and linter.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Badge for your README
Markdown
[](/listings/atmirrr--persian-motion-director)HTML
<a href="/listings/atmirrr--persian-motion-director"><img src="/api/listings/atmirrr--persian-motion-director/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
Claude Code (personal skills):
git clone https://github.com/atmirrr/persian-motion-director ~/.claude/skills/persian-motion-director
Or put it in a project's `.claude/skills/` folder. Claude picks it up when you ask for motion with Persian or RTL text, or when you say an animation looks "like a slideshow".
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
SKILL.md · Manifest · 78 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- ---
- name: persian-motion-director
- description: Direct and build professional motion design (promo and launch films, kinetic typography, animated explainers, social clips, title sequences) with correct Persian/Farsi and right-to-left typography, in Remotion or plain web code. Use this skill whenever the user wants a video, animation, motion graphics, teaser or animated text that contains Persian, Farsi, Arabic-script or RTL text, and whenever they say a motion piece looks "default", "like a slideshow", "AI-made" or "not pro", or that the Persian looks off, broken or disconnected, even if they never say "motion design". It brings the anti-slideshow method (one camera, objects that carry across scenes, music-first beat-locked edits), eight ready techniques with live sketches, HarfBuzz tooling for per-letter and per-dot Persian animation, kashida stretching, and a Persian correctness checklist and linter.
- ---
- # Persian Motion Director
- You are directing, not just animating. Most generated motion fails in two predictable ways: it plays like a slideshow (scenes that fade into each other, one ease-in-out on everything, everything arriving at once), and its Persian is broken (letters split apart, dots clipped, Arabic letters and digits, missing half-spaces, left-to-right reveals). This skill fixes both. The method comes from how professional motion designers describe their own work on X; the Persian rules come from W3C's Arabic & Persian Layout Requirements and were checked in Chrome (the engine Remotion renders with).
- ## The director's loop
- Work in this order. Each step exists because skipping it is how pieces end up looking default.
- 1. **Read the brief and fill only real gaps.** Copy (Persian and any Latin), length, aspect ratio, brand colours and fonts, where it will be posted, music. If a brand exists, use its palette and fonts instead of inventing one.
- 2. **Show directions before building.** Motion is subjective and expensive to redo. Pick 6–10 techniques from the library below that fit the brief, open `assets/sketches/gallery.html` (or render the clips) and let the user choose. Rework after a full build costs ten times more than a pick list.
- 3. **Music first.** Lock the track and its tempo before animating. Build a bar map: which section lives on which bars. If there's no track, compose one (`assets/music/compose_shur_pulse.py` is a working example that writes `beats.json`) or ask for one. At 120 BPM one beat is 0.5 s and one bar 2 s; at 60 fps a beat is 30 frames.
- 4. **Write the shot list on the bar grid** (template in `references/workflow.md`). Every section change lands on a downbeat; every cut on a beat or 2 frames before it.
- 5. **Style frames.** Render 4–6 stills (`assets/remotion/render-stills.mjs`) and get a yes before animating everything.
- 6. **Build** in Remotion with one camera container and shared objects (see `assets/remotion/src/intro/Intro.tsx` for a complete worked example).
- 7. **Check**, then render: run `scripts/lint_persian.py` on all copy, review stills at full size for clipped dots and broken joins, scrub every cut against the beat, and make loops exact (clip length = a whole number of loops).
- ## What separates pro motion from a slideshow
- | Slideshow habit | What to do instead |
- |---|---|
- | Scenes chained with fade transitions | One camera travels between scenes, or one object carries into the next scene. Never `fade()` scene to scene. |
- | The same ease-in-out on everything | Each move gets its own curve. Entrances: `bezier(.16,1,.3,1)` over ~20 frames. Exits: `bezier(.7,0,.84,0)` over ~8 frames, travelling only ~70% as far. |
- | Everything arrives together, evenly spaced | One lead element, the rest 2–4 frames behind, spaced on a curve rather than evenly. |
- | Remotion's default bouncy `spring()` (overshoots ~16%) | Under 2% overshoot on UI, none on text: stiffness 100 / damping 16 gives ~1.5%. |
- | Music laid on at the end | Music first; cuts on the beat; sound attacks placed on the visual hits. |
- | Centered text on a gradient, logo at the end | Show the real product doing a real task in the first 10 seconds. |
- | Freezes, or motion that never pauses | Hold long enough to read; only the camera breathes (zoom 1.00 → 1.04 per scene). |
- | Grain, halftone or ASCII as a finish | Texture only with a physical reason (paper, print, light). These finishes are now the AI default. |
- More numbers and the sources behind them: `references/anti-slideshow.md`.
- ## Persian non-negotiables
- Read `references/persian-typography.md` before writing any Persian into a frame. The short version:
- 1. **Never put Persian letters in their own boxes.** `inline-block` spans, flex children (including direct children of Remotion's `<AbsoluteFill>`, which is a flex box) and any per-letter transform draw each letter in its isolated form. Animate whole words or lines. When you truly need per-letter or per-dot motion, use shaped outlines (`scripts/shape_persian.py`) or zero-width-joiner splitting (`scripts/split_fa.js`).
- 2. **Fade words, not letters.** Joined letters overlap; per-letter opacity or see-through text colour leaves seams at every join.
- 3. **Masks need slack.** Persian reaches far above and below Latin: pad clip masks by about 0.5em top and bottom, use line-height ≥ 1.6 (≥ 2.4 for Nastaliq), or the dots and the top of گ get cut.
- 4. **Direction.** `dir="rtl" lang="fa"` on every Persian block; wrap Latin names and numbers in `<bdi>` (or FSI/PDI) or the line scrambles. Reveals and staggers start on the right, camera progress travels left, "next" arrows point left. Play buttons, clocks and numbers are never mirrored.
- 5. **Characters.** Persian ی (U+06CC) and ک (U+06A9), never Arabic ي/ك; Persian digits ۰–۹ (U+06F0–06F9), never Arabic-Indic ٠–٩; the half-space (ZWNJ, U+200C) in می, ‑ها, ‑تر/‑ترین; punctuation ، ؛ ؟ « ». `scripts/lint_persian.py` catches these.
- 6. **No letter-spacing.** Chrome ignores it inside Persian words (since version 137) and other tools break the joins. Stretch with kashida instead, only after a letter that joins forward, at most one per word.
- 7. **Load the font, every time.** If the Persian font (or its Arabic-script subset) isn't loaded, Chrome silently falls back to a system font. In Remotion use `FontFace` + `delayRender` (see `assets/remotion/src/fonts.ts`).
- 8. **Copy.** Write natural Persian in one register; no word-for-word English idioms. A native reader signs off on every line before render (`references/persian-copy.md`).
- ## Technique library
- Live code for each is in `assets/sketches/sketches.js` (plain JS, a pure function of time) and runs both in a browser page and in Remotion through `SketchPlayer`. Details, numbers and the X posts each comes from are in `references/techniques/`.
- | # | Technique | Use it for | Sketch id |
- |---|---|---|---|
- | 01 | One camera, no cuts | The spine of a film: scenes on one strip, whip pans with motion blur and parallax | `oner` |
- | 02 | One shape carries the story | Transitions: a full stop grows into a chat bubble, then into the next full stop | `match` |
- | 03 | The real UI, directed | Product beats: real interface in 3D, cursor on arcs, focus pulls | `ui` |
- | 04 | Cut on the beat | Feature runs and kinetic type: hard cuts on every beat, punch-ins, inverted frames | `beat` |
- | 05 | On twos, with line boil | A hand-drawn layer over clean UI: drawings hold 2 frames, lines wobble 12×/s | `boil` |
- | 06 | Paper cut-out letters | Warm title cards: each joined letter group is a rigid paper piece | `cutout` |
- | 07 | Dots last | Wordmarks and reveals: letter bodies first, then the dots drop in | `nuqta` |
- | 08 | Kashida, not letter-spacing | Emphasis on a held note: stretch the joining stroke, measured in calligraphic dots | `kashida` |
- Pick by the brief, not by novelty: one or two signature techniques used consistently read as a system; all eight at once read as a reel.
- ## Tools in this skill
- - `scripts/shape_persian.py` — shapes Persian with HarfBuzz and exports SVG outlines split into letter bodies, dots and connected letter groups (`pip install uharfbuzz fonttools`). This is what makes per-letter, per-dot and kashida animation possible without breaking the script.
- - `scripts/split_fa.js` — splits a Persian word into letters that keep their joined forms (zero-width joiners), for when outlines are overkill.
- - `scripts/lint_persian.py` — checks copy (Arabic letters and digits, missing half-spaces, English punctuation, misplaced kashida) and code (letter-spacing, per-letter boxes, missing `dir`).
- - `assets/sketches/` — the motion engine (`engine.js`), the eight sketches, shaped glyph data, styles and `gallery.html` (serve the folder with any static server).
- - `assets/remotion/` — `SketchPlayer` (drives a sketch from the frame number), one clip composition per technique, the full intro film as a worked example, and scripts to render clips and stills.
- - `assets/music/compose_shur_pulse.py` — an original 120 BPM track in Dastgah Shur written in code, with a beat map; shows how to make the edit lock to the music.
- ## When the user only wants a quick piece
- Still keep the two non-negotiables that cost nothing: no per-letter boxes for Persian, and no scene-to-scene fades. Use one technique well, set the timing on a beat grid, and render stills to check the Persian before the full render.
README.md · README · 114 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
- <div align="center">
- # persian-motion-director
- **A Claude skill for professional motion design with correct Persian typography.**<br>
- Films that don't play like slideshows, and Persian that doesn't fall apart.
- </div>
- Most generated motion fails in two predictable ways. It plays like a slideshow: scenes fade into each other, one ease-in-out on everything, everything arrives at once. And its Persian breaks: letters split apart when animated, dots get clipped, Arabic letters and digits slip in, half-spaces go missing, reveals run the wrong way.
- This skill teaches Claude to direct instead: show directions before building, lock the music first, cut on the beat, keep one camera moving, and set Persian the way a Persian reader expects. It comes with eight working techniques, tooling for per-letter and per-dot Persian animation, and a checklist and linter for Persian copy.
- ## Eight techniques
- Every sketch is plain JavaScript, a pure function of time, so the same code runs live in a browser and frame-exact in [Remotion](https://www.remotion.dev).
- | | |
- |---|---|
- | <img src="media/01-oner.gif" alt="One camera, no cuts" width="100%"><br>**01 · One camera, no cuts** · یک دوربین، بدون کات<br>Scenes on one strip, right to left; whip pans with motion blur and parallax. | <img src="media/02-match.gif" alt="One shape carries the story" width="100%"><br>**02 · One shape carries the story** · یک شکل، کلِ داستان<br>The full stop grows into the reply bubble, then into the next full stop. |
- | <img src="media/03-ui.gif" alt="The real UI, directed" width="100%"><br>**03 · The real UI, directed** · رابطِ واقعی، کارگردانیشده<br>RTL interface in 3D, a cursor on arcs, a focus pull. | <img src="media/04-beat.gif" alt="Cut on the beat" width="100%"><br>**04 · Cut on the beat** · کات روی ضرب<br>Music first; a hard cut on every beat, punch-ins, inverted frames. |
- | <img src="media/05-boil.gif" alt="On twos, with line boil" width="100%"><br>**05 · On twos, with line boil** · دوفریمی، با خطِ لرزان<br>Drawings hold two frames, lines wobble; the camera stays smooth. | <img src="media/06-cutout.gif" alt="Paper cut-out letters" width="100%"><br>**06 · Paper cut-out letters** · حروفِ کاغذی<br>Each joined letter group is a rigid paper piece, one light, matching shadows. |
- | <img src="media/07-nuqta.gif" alt="Dots last" width="100%"><br>**07 · Dots last** · نقطهها آخر<br>Letter bodies first, right to left; then the dots drop in. | <img src="media/08-kashida.gif" alt="Kashida, not letter-spacing" width="100%"><br>**08 · Kashida, not letter-spacing** · کشیده، نه فاصله<br>Stretch the joining stroke, measured in calligraphic dots. |
- ## What's inside
- ```
- SKILL.md the director's loop, anti-slideshow rules, Persian non-negotiables
- references/
- workflow.md brief → directions → music first → shot list on the bar grid → style frames → build → checks
- anti-slideshow.md curves, springs, staggers, holds, motion blur, rhythm (with numbers and sources)
- persian-typography.md joining, masks, bidi, characters, kashida, fonts, a review checklist
- persian-copy.md natural Persian for motion, common machine-copy mistakes
- techniques/01…08 one file per technique: recipe, values, Persian notes, the X posts behind it
- scripts/
- shape_persian.py HarfBuzz shaping → SVG outlines split into letter bodies, dots and joined groups
- split_fa.js split a word into letters that keep their joined forms (zero-width joiners)
- lint_persian.py lint copy (ي/ك, digits, half-spaces, punctuation, kashida) and code (letter boxes, letter-spacing, fades)
- assets/
- sketches/ motion engine, the eight sketches, shaped glyph data, gallery.html
- remotion/ SketchPlayer adapter, one clip per technique, the intro film, render scripts
- music/compose_shur_pulse.py an original 120 BPM track in Dastgah Shur, written in code, with a beat map
- ```
- ## Install
- Claude Code (personal skills):
- ```bash
- git clone https://github.com/atmirrr/persian-motion-director ~/.claude/skills/persian-motion-director
- ```
- Or put it in a project's `.claude/skills/` folder. Claude picks it up when you ask for motion with Persian or RTL text, or when you say an animation looks "like a slideshow".
- ## Use
- Things to ask Claude:
- - "Make a 30-second Persian teaser for my app in Remotion, cut to music."
- - "This animation looks like a slideshow. Make it feel pro."
- - "My Persian title breaks into separate letters when I animate it."
- - "Show me 8 motion directions for our launch film before you build anything."
- Check Persian copy and code yourself:
- ```bash
- python3 scripts/lint_persian.py copy copy.txt
- python3 scripts/lint_persian.py code src/
- pip install uharfbuzz fonttools
- python3 scripts/shape_persian.py assets/sketches/fonts/Vazirmatn-VF.ttf "کارگردان موشن فارسی" --wght 800
- ```
- ## Run the examples
- Live sketches in a browser:
- ```bash
- cd assets/sketches && python3 -m http.server 8000 # open http://localhost:8000/gallery.html
- ```
- Render the clips and the intro film with Remotion:
- ```bash
- cd assets/remotion
- npm install
- npx remotion studio src/index.ts # browse every composition
- node render-clips.mjs out # the eight technique clips
- node render-clips.mjs out --only Intro # the 82-second intro film
- python3 ../music/compose_shur_pulse.py public/music # rebuild the music (WAV) and beat map, then convert to MP3
- ```
- The intro film is the worked example: music first (120 BPM, Shur on D), a bar map, every cut on a beat, one camera that whips right to left between sections, and Persian set correctly throughout. See `assets/remotion/src/intro/Intro.tsx`.
- ## Where the method comes from
- The anti-slideshow rules and the eight techniques come from research into how professional motion designers describe their own work on X (October 2026, about 100 posts, each one checked to exist). Every technique file links the posts it draws on. The Persian rules follow W3C's [Arabic & Persian Layout Requirements](https://www.w3.org/TR/alreq/) and were tested in Chrome, the engine Remotion renders with.
- <div dir="rtl" lang="fa">
- ## به فارسی
- **کارگردانِ موشنِ فارسی** یک اسکیل متنباز برای Claude است که دو مشکل همیشگی موشنهای ساختهشده با هوش مصنوعی را حل میکند: حسِ اسلایدشو، و فارسیِ بههمریخته.
- - اول جهتها را نشان میدهد و بعد میسازد؛ اول موسیقی، بعد تدوین، و هر کات روی ضرب.
- - یک دوربین که بین صحنهها از راست به چپ حرکت میکند، بهجای محو شدن صحنهها در هم.
- - حروف فارسی هیچوقت از هم جدا نمیشوند؛ برای انیمیشنِ حرفبهحرف و نقطهبهنقطه، متن با HarfBuzz شکلدهی میشود.
- - اعداد فارسی، «ی» و «ک» فارسی، نیمفاصله، علامتگذاری فارسی و جهت راست به چپ، همه با یک چکلیست و یک لینتر کنترل میشوند.
- - بهجای فاصله انداختن بین حروف، کشیده؛ همانجایی که خط اجازه میدهد.
- </div>
- ## License
- Code: MIT. Vazirmatn: SIL Open Font License (`assets/sketches/fonts/OFL.txt`). The music in `assets/remotion/public/music` is generated by `assets/music/compose_shur_pulse.py` and is free to use. Example copy uses the word هرمس (Hermes) from the original brief; the default palette (`#0000F2`, `#F2F2F2`, `#F2F200`) is set with CSS variables and easy to change.
assets/sketches/glyphs.js · Bundled script · 2 lines
- /* Generated by scripts/shape_persian.py. Do not edit by hand. */
- export const GLYPHS = {"nuqta":{"t":"بقیهاش با هرمس","w":14496,"upem":2048,"asc":2100,"desc":-1100,"g":[[0,0,2558,14,"M713 -228Q572 -228 491 -181Q410 -133 376 -52Q342 28 342 124Q342 212 367 313Q392 414 429 520L186 613Q137 487 111 359Q85 232 85 112Q85 -66 152 -208Q219 -349 359 -432Q498 -514 713 -514Q905 -514 1041 -445Q1178 -377 1257 -250Q1336 -124 1355 48Q1386 25 1424 13Q1462 0 1507 0Q1595 0 1659 37Q1724 74 1775 128Q1817 74 1879 37Q1940 0 2029 0Q2115 0 2176 34Q2236 68 2277 119Q2318 64 2388 32Q2458 0 2550 0H2578V289H2548Q2471 289 2435 319Q2399 348 2394 422L2374 711L2122 680Q2127 618 2131 550Q2135 482 2135 446Q2135 396 2125 361Q2115 326 2092 308Q2068 289 2028 289Q1965 289 1938 325Q1911 360 1907 422L1887 692L1635 661Q1638 625 1641 580Q1645 535 1646 498Q1648 460 1648 446Q1648 358 1620 324Q1592 289 1509 289Q1428 290 1384 339Q1340 387 1317 457L1250 663L983 563Q1026 459 1061 345Q1095 231 1095 122Q1095 22 1060 -57Q1024 -136 941 -182Q858 -228 713 -228Z",[],[],8],[2558,0,957,13,"M635 543Q704 543 744 497Q783 451 783 387Q783 337 760 299Q738 261 684 261Q661 261 632 269Q602 277 566 298Q543 311 516 330Q490 349 461 375Q478 411 503 449Q527 488 560 516Q593 543 635 543Z M683 -23Q801 -23 880 31Q958 85 997 178Q1036 271 1036 389Q1036 504 986 601Q936 699 844 759Q752 818 626 818Q536 818 469 780Q401 742 351 682Q301 621 260 554Q220 487 183 426Q146 366 107 327Q68 289 19 289H-20V0H24Q100 0 151 18Q201 36 238 66Q276 95 312 132Q370 88 429 53Q488 18 551 -3Q614 -23 683 -23Z",[],[],8],[3515,0,817,12,"M809 0H837V289H798Q733 289 700 333Q667 376 650 441L592 667L323 580Q356 482 385 368Q414 254 414 164Q414 28 357 -59Q301 -145 196 -196Q91 -247 -54 -278L45 -545Q219 -512 347 -434Q475 -356 554 -237Q633 -118 659 35Q687 19 726 9Q765 0 809 0Z",[],[],7],[4332,0,1449,11,"M369 525Q369 580 417 620Q465 661 529 661Q570 661 604 639Q637 616 657 581Q677 546 677 505Q677 469 651 437Q624 405 589 384Q555 363 527 357Q488 369 452 395Q416 420 393 454Q369 488 369 525Z M471 835Q647 756 765 696Q882 636 953 592Q1023 548 1059 515Q1095 483 1107 460Q1118 436 1118 419Q1118 334 1069 304Q1020 273 961 273Q942 273 898 277Q854 281 807 289Q834 322 854 362Q874 401 885 447Q896 493 896 544Q896 645 839 721Q782 798 694 842Q606 886 514 886Q384 886 296 831Q208 777 164 694Q120 610 120 523Q120 485 129 442Q138 398 153 359Q169 320 189 293Q158 291 129 290Q99 289 66 289H-20V0H79Q189 0 304 28Q419 56 510 87Q562 71 631 53Q700 35 776 22Q852 10 922 10Q1124 10 1245 117Q1367 224 1367 427Q1367 535 1316 617Q1266 699 1167 771Q1068 842 924 915Q780 988 593 1076L471 835Z",[],[],7],[5781,0,508,10,"",[],[],6],[6289,0,570,9,"M136 1402V464Q136 232 239 116Q341 0 565 0H590V289H565Q467 289 436 335Q406 381 406 488V1402H136Z",[],[],5],[6859,0,629,8,"M-21 289V0H27V289H-21Z M159 0Q307 0 391 61Q476 123 511 229Q547 334 547 468Q547 552 536 644Q524 736 505 831L243 763Q260 686 276 605Q293 524 293 457Q293 384 264 336Q236 289 160 289H0V0H159Z",["M185 -118 6 -298 185 -477 365 -298 185 -118Z"],[[6,-477,365,-118]],5],[7488,0,508,7,"",[],[],4],[7996,0,2470,6,"M1508 0Q1596 0 1660 37Q1725 74 1776 128Q1818 74 1879 37Q1940 0 2031 0Q2167 0 2244 67Q2321 134 2354 242Q2387 351 2387 475Q2387 563 2374 652Q2361 741 2341 821L2082 750Q2089 728 2101 678Q2113 628 2124 568Q2134 507 2134 450Q2134 406 2124 370Q2115 333 2092 311Q2069 289 2029 289Q1964 289 1939 325Q1913 360 1908 422L1887 692L1635 661Q1638 625 1641 582Q1645 539 1647 504Q1648 469 1648 454Q1648 366 1621 328Q1593 289 1510 289Q1429 290 1384 338Q1340 387 1317 457L1250 663L983 563Q1026 459 1061 345Q1095 231 1095 122Q1095 22 1060 -57Q1024 -136 941 -182Q858 -228 713 -228Q572 -228 491 -181Q410 -133 376 -52Q342 28 342 124Q342 212 367 313Q392 414 429 520L186 613Q137 487 111 359Q85 232 85 112Q85 -66 152 -208Q219 -349 359 -432Q498 -514 713 -514Q905 -514 1041 -445Q1178 -377 1257 -250Q1336 -124 1355 48Q1387 29 1424 14Q1461 0 1508 0Z",["M1721 1428 1560 1267 1721 1106 1882 1267 1721 1428Z","M1896 1173 1735 1012 1896 851 2057 1012 1896 1173Z","M1547 1173 1386 1012 1547 851 1708 1012 1547 1173Z"],[[1560,1106,1882,1428],[1735,851,2057,1173],[1386,851,1708,1173]],3],[10466,0,543,5,"M407 1402H137V1H407V1402Z",[],[],2],[11009,0,0,4,"",[],[],1],[11009,0,1096,3,"M1081 0H1116V289H1085Q1013 289 975 330Q937 371 928 432L833 1074L591 1025L598 977Q500 947 408 905Q317 863 243 804Q169 746 126 670Q82 594 82 497Q82 321 193 230Q303 139 470 139Q539 139 601 161Q662 183 721 229Q747 148 796 97Q845 47 916 23Q988 0 1081 0Z M666 537Q666 496 635 468Q604 440 558 426Q512 413 465 413Q412 413 378 438Q344 463 344 505Q344 537 370 566Q397 595 439 622Q482 648 535 670Q587 691 641 710L658 605Q662 586 664 569Q666 552 666 537Z",[],[],0],[12105,0,743,2,"M-22 289V0H58V289H-22Z M312 687Q316 634 319 578Q322 522 322 464Q322 364 281 327Q239 289 129 289H33V0H129Q223 0 307 34Q391 69 451 130Q482 91 524 62Q566 33 620 17Q674 0 740 0H763V289H742Q688 289 654 304Q620 318 602 350Q585 382 582 432L562 718L312 687Z",["M342 -128 171 -298 342 -470 513 -298 342 -128Z","M4 -128 -166 -298 4 -470 176 -298 4 -128Z"],[[171,-470,513,-128],[-166,-470,176,-128]],0],[12848,0,1019,1,"M541 657Q570 657 603 636Q636 614 659 583Q682 552 682 522Q682 484 660 448Q638 412 606 383Q574 354 543 337Q515 353 483 381Q450 410 427 446Q405 483 405 520Q405 550 427 582Q449 613 480 635Q512 657 541 657Z M938 522Q938 603 904 676Q871 750 815 809Q758 867 687 901Q616 935 539 935Q464 935 395 900Q325 866 270 808Q214 750 182 676Q149 603 149 524Q149 481 156 442Q163 403 179 365Q194 328 219 291Q200 291 186 290Q171 289 158 289Q145 289 129 289H-20V0H162Q221 0 285 11Q349 22 414 40Q479 57 539 78Q597 58 660 41Q723 23 785 12Q847 0 903 0H1039V289H943Q932 289 920 289Q908 289 895 290Q882 290 866 290Q892 327 908 364Q923 400 930 440Q938 479 938 522Z",["M705 1382 534 1212 705 1040 876 1212 705 1382Z","M367 1382 197 1212 367 1040 539 1212 367 1382Z"],[[534,1040,876,1382],[197,1040,539,1382]],0],[13867,0,629,0,"M-21 289V0H27V289H-21Z M159 0Q307 0 391 61Q476 123 511 229Q547 334 547 468Q547 552 536 644Q524 736 505 831L243 763Q260 686 276 605Q293 524 293 457Q293 384 264 336Q236 289 160 289H0V0H159Z",["M185 -118 6 -298 185 -477 365 -298 185 -118Z"],[[6,-477,365,-118]],0]]},"kashida":{"t":"هرمـس","w":6346,"upem":2048,"asc":2100,"desc":-1100,"g":[[0,0,2558,4,"M713 -228Q572 -228 491 -181Q410 -133 376 -52Q342 28 342 124Q342 212 367 313Q392 414 429 520L186 613Q137 487 111 359Q85 232 85 112Q85 -66 152 -208Q219 -349 359 -432Q498 -514 713 -514Q905 -514 1041 -445Q1178 -377 1257 -250Q1336 -124 1355 48Q1386 25 1424 13Q1462 0 1507 0Q1595 0 1659 37Q1724 74 1775 128Q1817 74 1879 37Q1940 0 2029 0Q2115 0 2176 34Q2236 68 2277 119Q2318 64 2388 32Q2458 0 2550 0H2578V289H2548Q2471 289 2435 319Q2399 348 2394 422L2374 711L2122 680Q2127 618 2131 550Q2135 482 2135 446Q2135 396 2125 361Q2115 326 2092 308Q2068 289 2028 289Q1965 289 1938 325Q1911 360 1907 422L1887 692L1635 661Q1638 625 1641 580Q1645 535 1646 498Q1648 460 1648 446Q1648 358 1620 324Q1592 289 1509 289Q1428 290 1384 339Q1340 387 1317 457L1250 663L983 563Q1026 459 1061 345Q1095 231 1095 122Q1095 22 1060 -57Q1024 -136 941 -182Q858 -228 713 -228Z",[],[],1],[2558,0,565,3,"M-20 289V0H585V289H-20Z",[],[],1],[3123,0,957,2,"M635 543Q704 543 744 497Q783 451 783 387Q783 337 760 299Q738 261 684 261Q661 261 632 269Q602 277 566 298Q543 311 516 330Q490 349 461 375Q478 411 503 449Q527 488 560 516Q593 543 635 543Z M683 -23Q801 -23 880 31Q958 85 997 178Q1036 271 1036 389Q1036 504 986 601Q936 699 844 759Q752 818 626 818Q536 818 469 780Q401 742 351 682Q301 621 260 554Q220 487 183 426Q146 366 107 327Q68 289 19 289H-20V0H24Q100 0 151 18Q201 36 238 66Q276 95 312 132Q370 88 429 53Q488 18 551 -3Q614 -23 683 -23Z",[],[],1],[4080,0,817,1,"M809 0H837V289H798Q733 289 700 333Q667 376 650 441L592 667L323 580Q356 482 385 368Q414 254 414 164Q414 28 357 -59Q301 -145 196 -196Q91 -247 -54 -278L45 -545Q219 -512 347 -434Q475 -356 554 -237Q633 -118 659 35Q687 19 726 9Q765 0 809 0Z",[],[],0],[4897,0,1449,0,"M369 525Q369 580 417 620Q465 661 529 661Q570 661 604 639Q637 616 657 581Q677 546 677 505Q677 469 651 437Q624 405 589 384Q555 363 527 357Q488 369 452 395Q416 420 393 454Q369 488 369 525Z M471 835Q647 756 765 696Q882 636 953 592Q1023 548 1059 515Q1095 483 1107 460Q1118 436 1118 419Q1118 334 1069 304Q1020 273 961 273Q942 273 898 277Q854 281 807 289Q834 322 854 362Q874 401 885 447Q896 493 896 544Q896 645 839 721Q782 798 694 842Q606 886 514 886Q384 886 296 831Q208 777 164 694Q120 610 120 523Q120 485 129 442Q138 398 153 359Q169 320 189 293Q158 291 129 290Q99 289 66 289H-20V0H79Q189 0 304 28Q419 56 510 87Q562 71 631 53Q700 35 776 22Q852 10 922 10Q1124 10 1245 117Q1367 224 1367 427Q1367 535 1316 617Q1266 699 1167 771Q1068 842 924 915Q780 988 593 1076L471 835Z",[],[],0]]},"hermes":{"t":"هرمس","w":5781,"upem":2048,"asc":2100,"desc":-1100,"g":[[0,0,2558,3,"M713 -228Q572 -228 491 -181Q410 -133 376 -52Q342 28 342 124Q342 212 367 313Q392 414 429 520L186 613Q137 487 111 359Q85 232 85 112Q85 -66 152 -208Q219 -349 359 -432Q498 -514 713 -514Q905 -514 1041 -445Q1178 -377 1257 -250Q1336 -124 1355 48Q1386 25 1424 13Q1462 0 1507 0Q1595 0 1659 37Q1724 74 1775 128Q1817 74 1879 37Q1940 0 2029 0Q2115 0 2176 34Q2236 68 2277 119Q2318 64 2388 32Q2458 0 2550 0H2578V289H2548Q2471 289 2435 319Q2399 348 2394 422L2374 711L2122 680Q2127 618 2131 550Q2135 482 2135 446Q2135 396 2125 361Q2115 326 2092 308Q2068 289 2028 289Q1965 289 1938 325Q1911 360 1907 422L1887 692L1635 661Q1638 625 1641 580Q1645 535 1646 498Q1648 460 1648 446Q1648 358 1620 324Q1592 289 1509 289Q1428 290 1384 339Q1340 387 1317 457L1250 663L983 563Q1026 459 1061 345Q1095 231 1095 122Q1095 22 1060 -57Q1024 -136 941 -182Q858 -228 713 -228Z",[],[],1],[2558,0,957,2,"M635 543Q704 543 744 497Q783 451 783 387Q783 337 760 299Q738 261 684 261Q661 261 632 269Q602 277 566 298Q543 311 516 330Q490 349 461 375Q478 411 503 449Q527 488 560 516Q593 543 635 543Z M683 -23Q801 -23 880 31Q958 85 997 178Q1036 271 1036 389Q1036 504 986 601Q936 699 844 759Q752 818 626 818Q536 818 469 780Q401 742 351 682Q301 621 260 554Q220 487 183 426Q146 366 107 327Q68 289 19 289H-20V0H24Q100 0 151 18Q201 36 238 66Q276 95 312 132Q370 88 429 53Q488 18 551 -3Q614 -23 683 -23Z",[],[],1],[3515,0,817,1,"M809 0H837V289H798Q733 289 700 333Q667 376 650 441L592 667L323 580Q356 482 385 368Q414 254 414 164Q414 28 357 -59Q301 -145 196 -196Q91 -247 -54 -278L45 -545Q219 -512 347 -434Q475 -356 554 -237Q633 -118 659 35Q687 19 726 9Q765 0 809 0Z",[],[],0],[4332,0,1449,0,"M369 525Q369 580 417 620Q465 661 529 661Q570 661 604 639Q637 616 657 581Q677 546 677 505Q677 469 651 437Q624 405 589 384Q555 363 527 357Q488 369 452 395Q416 420 393 454Q369 488 369 525Z M471 835Q647 756 765 696Q882 636 953 592Q1023 548 1059 515Q1095 483 1107 460Q1118 436 1118 419Q1118 334 1069 304Q1020 273 961 273Q942 273 898 277Q854 281 807 289Q834 322 854 362Q874 401 885 447Q896 493 896 544Q896 645 839 721Q782 798 694 842Q606 886 514 886Q384 886 296 831Q208 777 164 694Q120 610 120 523Q120 485 129 442Q138 398 153 359Q169 320 189 293Q158 291 129 290Q99 289 66 289H-20V0H79Q189 0 304 28Q419 56 510 87Q562 71 631 53Q700 35 776 22Q852 10 922 10Q1124 10 1245 117Q1367 224 1367 427Q1367 535 1316 617Q1266 699 1167 771Q1068 842 924 915Q780 988 593 1076L471 835Z",[],[],0]]},"sendA":{"t":"یک پیام بفرست.","w":13396,"upem":2048,"asc":2100,"desc":-1100,"g":[[0,0,611,13,"M131 168Q131 96 182 48Q232 0 306 0Q378 0 429 48Q479 96 479 168Q479 239 428 287Q378 335 306 335Q234 335 183 287Q131 239 131 168Z",[],[],7],[611,0,1923,12,"M1500 669Q1504 622 1507 564Q1510 505 1510 456Q1510 375 1455 335Q1399 295 1295 282Q1190 269 1042 269H875Q759 269 659 277Q560 286 486 310Q411 334 370 381Q328 428 328 505Q328 560 344 619Q360 679 377 725L153 810Q124 739 105 658Q85 576 85 490Q85 343 142 247Q199 152 304 98Q409 44 554 22Q699 0 875 0H1042Q1255 0 1386 38Q1516 76 1606 162Q1655 84 1730 42Q1806 0 1920 0H1943V269H1920Q1835 269 1797 305Q1759 342 1754 421L1734 697L1500 669Z",["M1106 1074 942 910 1106 744 1272 910 1106 1074Z","M769 1074 606 910 769 744 935 910 769 1074Z"],[[942,744,1272,1074],[606,744,935,1074]],6],[2534,0,1475,11,"M677 0Q763 0 829 37Q894 73 946 133Q987 75 1048 38Q1109 0 1200 0Q1333 0 1408 66Q1484 131 1516 237Q1549 343 1549 463Q1549 549 1536 636Q1523 722 1503 799L1262 733Q1268 709 1280 660Q1292 611 1301 553Q1311 494 1311 438Q1311 392 1301 354Q1290 315 1266 292Q1241 269 1199 269Q1131 269 1102 308Q1073 348 1069 413L1048 672L814 643Q817 605 820 563Q823 521 825 487Q826 453 826 438Q826 346 797 307Q767 269 679 269Q606 269 570 306Q533 343 528 413L507 672L273 643Q276 605 279 564Q282 522 284 488Q285 454 285 438Q285 366 264 330Q242 293 196 281Q150 269 74 269H-20V0H72Q192 0 267 35Q342 70 396 131Q438 71 506 35Q573 0 677 0Z",[],[],6],[4009,0,812,10,"M804 0H832V269H793Q726 269 691 311Q655 352 637 421L579 644L331 562Q364 465 390 355Q417 245 417 155Q417 22 363 -67Q309 -156 206 -210Q102 -265 -46 -298L46 -544Q222 -509 348 -429Q473 -348 548 -229Q623 -110 647 39Q674 22 715 11Q756 0 804 0Z",[],[],5],[4821,0,1019,9,"M540 657Q572 657 606 634Q641 611 666 578Q690 545 690 512Q690 472 668 434Q645 395 611 364Q577 334 542 316Q512 332 478 363Q443 394 420 433Q396 471 396 510Q396 543 420 577Q443 611 476 634Q510 657 540 657Z M929 512Q929 590 897 661Q864 733 809 791Q754 848 684 882Q614 915 539 915Q466 915 397 881Q329 848 275 790Q221 733 189 661Q157 590 157 514Q157 470 166 429Q174 388 192 349Q210 310 238 271Q215 270 196 270Q178 269 161 269Q145 269 127 269H-20V0H154Q209 0 274 10Q340 20 408 38Q476 55 539 77Q601 56 667 38Q733 21 796 11Q859 0 911 0H1039V269H943Q930 269 915 269Q900 269 883 269Q866 269 846 270Q875 309 893 347Q911 386 920 427Q929 467 929 512Z",["M532 1384 359 1210 532 1037 705 1210 532 1384Z"],[[359,1037,705,1384]],5],[5840,0,624,8,"M-21 269V0H27V269H-21Z M160 0Q303 0 386 60Q469 120 504 223Q539 327 539 458Q539 539 528 628Q517 718 498 809L253 746Q269 669 285 590Q300 510 300 443Q300 367 270 318Q241 269 160 269H0V0H160Z",["M185 -125 12 -298 185 -471 358 -298 185 -125Z"],[[12,-471,358,-125]],5],[6464,0,516,7,"",[],[],4],[6980,0,1259,6,"M936 366Q936 319 913 284Q891 248 838 248Q811 248 772 260Q733 272 687 292Q640 311 590 333Q602 369 619 406Q636 442 658 473Q681 503 710 522Q739 540 774 540Q823 540 859 516Q895 492 916 452Q936 412 936 366Z M354 374Q262 358 206 307Q151 256 123 176Q96 95 87 -11Q78 -117 78 -245Q78 -337 82 -435Q86 -532 92 -637H346Q344 -600 339 -539Q335 -478 332 -402Q329 -325 329 -243Q329 -163 333 -98Q336 -33 346 13Q355 60 371 84Q388 109 414 109Q444 109 492 90Q540 71 598 47Q657 22 718 3Q779 -16 834 -16Q946 -16 1022 36Q1097 88 1135 174Q1173 261 1173 365Q1173 495 1122 592Q1071 690 981 744Q891 798 770 798Q692 798 626 765Q561 731 509 672Q457 613 419 537Q380 461 354 374Z",[],[],3],[8239,0,563,5,"M139 1397V456Q139 226 240 113Q341 0 558 0H583V269H558Q459 269 424 315Q390 362 390 475V1397H139Z",[],[],2],[8802,0,743,4,"M-22 269V0H58V269H-22Z M320 669Q325 618 328 564Q330 511 330 455Q330 351 286 310Q242 269 129 269H33V0H129Q224 0 308 35Q393 70 452 134Q482 94 523 64Q564 34 618 17Q672 0 740 0H763V269H742Q686 269 650 285Q614 301 595 335Q577 369 574 421L554 697L320 669Z",["M342 -134 177 -298 342 -464 507 -298 342 -134Z","M4 -134 -159 -298 4 -464 171 -298 4 -134Z"],[[177,-464,507,-134],[-159,-464,171,-134]],2],[9545,0,728,3,"M-20 269V0H127V269H-20Z M264 0Q407 0 490 60Q573 120 608 223Q643 327 643 458Q643 539 632 628Q621 718 602 809L357 746Q373 669 389 590Q404 510 404 443Q404 367 374 318Q345 269 264 269H104V0H264Z",["M239 -359 83 -515 239 -671 395 -515 239 -359Z","M413 -104 257 -260 413 -416 569 -260 413 -104Z","M65 -104 -91 -260 65 -416 221 -260 65 -104Z"],[[83,-671,395,-359],[257,-416,569,-104],[-91,-416,221,-104]],2],[10273,0,516,2,"",[],[],1],[10789,0,1949,1,"M1128 0Q1259 0 1346 15Q1433 31 1493 66Q1554 101 1603 159Q1661 74 1742 37Q1824 0 1942 0H1969V269H1942Q1870 269 1826 289Q1783 310 1754 356Q1725 401 1693 476Q1669 536 1638 585Q1607 634 1567 677Q1528 720 1477 760Q1426 801 1364 843Q1301 884 1223 933L1780 1159V1424L1019 1113Q965 1092 940 1048Q914 1003 914 949Q914 898 935 851Q956 804 995 773Q1043 738 1103 699Q1164 660 1225 620Q1287 580 1339 540Q1391 500 1423 463Q1455 426 1455 395Q1455 344 1419 317Q1383 290 1311 279Q1238 269 1127 269H874Q758 269 659 277Q559 286 485 310Q411 334 369 381Q328 428 328 506Q328 560 344 620Q360 680 377 726L153 811Q124 740 105 658Q85 576 85 490Q85 343 142 247Q199 152 304 98Q409 44 554 22Q699 0 874 0H1128Z",[],[],0],[12738,0,658,0,"M-22 269V0H58V269H-22Z M194 0Q337 0 420 60Q503 120 538 223Q573 327 573 458Q573 539 562 628Q551 718 532 809L287 746Q303 669 319 590Q334 510 334 443Q334 367 304 318Q275 269 194 269H34V0H194Z",["M342 -134 177 -298 342 -464 507 -298 342 -134Z","M4 -134 -159 -298 4 -464 171 -298 4 -134Z"],[[177,-464,507,-134],[-159,-464,171,-134]],0]]},"restB":{"t":"بقیهاش با هرمس.","w":15057,"upem":2048,"asc":2100,"desc":-1100,"g":[[0,0,611,15,"M131 168Q131 96 182 48Q232 0 306 0Q378 0 429 48Q479 96 479 168Q479 239 428 287Q378 335 306 335Q234 335 183 287Q131 239 131 168Z",[],[],9],[611,0,2553,14,"M709 -249Q564 -249 481 -200Q398 -151 363 -69Q329 13 329 111Q329 199 353 300Q377 400 412 503L185 591Q138 469 113 344Q87 220 87 103Q87 -72 153 -211Q218 -351 356 -433Q493 -514 709 -514Q903 -514 1039 -445Q1174 -375 1250 -248Q1327 -122 1342 50Q1373 27 1413 13Q1453 0 1502 0Q1588 0 1654 37Q1719 73 1771 133Q1812 75 1873 38Q1934 0 2025 0Q2112 0 2172 35Q2232 71 2272 126Q2310 67 2380 33Q2450 0 2545 0H2573V269H2543Q2464 269 2425 302Q2386 335 2381 413L2361 690L2126 661Q2131 599 2135 536Q2138 474 2138 438Q2138 383 2127 346Q2116 308 2091 288Q2066 269 2024 269Q1956 269 1927 308Q1898 348 1894 413L1874 672L1639 643Q1642 605 1645 563Q1648 521 1650 487Q1651 453 1651 438Q1651 346 1622 307Q1592 269 1504 269Q1421 269 1375 317Q1328 365 1305 438L1238 641L990 547Q1030 448 1064 334Q1098 219 1098 109Q1098 9 1063 -72Q1027 -153 942 -201Q857 -249 709 -249Z",[],[],8],[3164,0,952,13,"M634 543Q707 543 749 492Q791 442 791 371Q791 317 765 279Q740 241 683 241Q659 241 627 250Q596 259 559 280Q535 294 507 315Q480 335 451 363Q469 402 495 444Q522 485 556 514Q591 543 634 543Z M682 -23Q797 -23 874 28Q950 80 989 170Q1028 260 1028 376Q1028 490 979 586Q930 682 839 740Q749 799 626 799Q535 799 469 761Q403 723 354 662Q305 601 265 534Q226 466 189 406Q152 345 112 307Q72 269 19 269H-20V0H24Q100 0 150 18Q200 36 238 66Q276 97 313 136Q372 89 430 53Q489 17 551 -3Q613 -23 682 -23Z",[],[],8],[4116,0,812,12,"M804 0H832V269H793Q726 269 691 311Q655 352 637 421L579 644L331 562Q364 465 390 355Q417 245 417 155Q417 22 363 -67Q309 -156 206 -210Q102 -265 -46 -298L46 -544Q222 -509 348 -429Q473 -348 548 -229Q623 -110 647 39Q674 22 715 11Q756 0 804 0Z",[],[],7],[4928,0,1444,11,"M363 512Q363 572 412 613Q461 655 529 655Q572 655 607 634Q641 612 662 576Q683 539 683 496Q683 458 658 425Q633 392 597 368Q561 345 527 335Q484 350 446 377Q409 404 386 439Q363 474 363 512Z M484 831Q643 759 755 701Q868 644 940 599Q1012 554 1052 519Q1092 484 1109 457Q1125 430 1125 408Q1125 322 1073 288Q1021 255 950 255Q927 255 881 259Q836 263 790 270Q821 304 843 344Q865 384 878 430Q890 477 890 531Q890 628 834 704Q779 779 693 823Q606 867 515 867Q391 867 305 816Q218 764 173 682Q128 600 128 510Q128 470 138 426Q148 382 166 343Q184 303 209 274Q173 271 139 270Q106 269 66 269H-20V0H79Q189 0 304 27Q420 54 510 86Q561 70 630 52Q700 34 776 22Q852 10 922 10Q1120 10 1240 114Q1359 217 1359 415Q1359 516 1309 596Q1260 676 1163 747Q1066 818 924 892Q782 966 597 1054L484 831Z",[],[],7],[6372,0,516,10,"",[],[],6],[6888,0,563,9,"M139 1397V456Q139 226 240 113Q341 0 558 0H583V269H558Q459 269 424 315Q390 362 390 475V1397H139Z",[],[],5],[7451,0,624,8,"M-21 269V0H27V269H-21Z M160 0Q303 0 386 60Q469 120 504 223Q539 327 539 458Q539 539 528 628Q517 718 498 809L253 746Q269 669 285 590Q300 510 300 443Q300 367 270 318Q241 269 160 269H0V0H160Z",["M185 -125 12 -298 185 -471 358 -298 185 -125Z"],[[12,-471,358,-125]],5],[8075,0,516,7,"",[],[],4],[8591,0,2461,6,"M1503 0Q1589 0 1655 37Q1720 73 1772 133Q1813 75 1874 38Q1934 0 2026 0Q2159 0 2234 66Q2310 131 2342 237Q2375 343 2375 463Q2375 549 2362 636Q2349 722 2329 799L2088 733Q2094 709 2106 660Q2118 611 2127 553Q2137 494 2137 438Q2137 392 2127 354Q2116 315 2092 292Q2067 269 2025 269Q1956 269 1928 308Q1900 348 1895 413L1874 672L1639 643Q1642 605 1645 565Q1648 525 1650 492Q1652 460 1652 444Q1652 353 1622 311Q1593 269 1505 269Q1421 269 1375 317Q1328 364 1305 438L1238 641L990 547Q1030 448 1064 334Q1098 219 1098 109Q1098 9 1063 -72Q1027 -153 942 -201Q857 -249 709 -249Q564 -249 481 -200Q398 -151 363 -69Q329 13 329 111Q329 199 353 300Q377 400 412 503L185 591Q138 469 113 344Q87 220 87 103Q87 -72 153 -211Q218 -351 356 -433Q493 -514 709 -514Q903 -514 1039 -445Q1174 -375 1250 -248Q1327 -122 1342 50Q1374 30 1413 15Q1452 0 1503 0Z",["M1716 1406 1560 1250 1716 1094 1872 1250 1716 1406Z","M1891 1151 1735 995 1891 839 2047 995 1891 1151Z","M1543 1151 1387 995 1543 839 1699 995 1543 1151Z"],[[1560,1094,1872,1406],[1735,839,2047,1151],[1387,839,1699,1151]],3],[11052,0,530,5,"M390 1397H140V1H390V1397Z",[],[],2],[11582,0,0,4,"",[],[],1],[11582,0,1089,3,"M1075 0H1109V269H1079Q1004 269 964 310Q924 352 915 417L821 1054L595 1008L602 960Q498 928 404 885Q311 841 240 783Q168 725 127 651Q85 577 85 484Q85 315 193 227Q301 139 463 139Q536 139 598 163Q660 186 719 235Q744 154 791 102Q838 50 909 25Q980 0 1075 0Z M668 531Q668 485 636 454Q605 423 557 408Q509 393 460 393Q402 393 366 420Q331 446 331 493Q331 526 356 557Q381 588 424 616Q468 643 524 668Q580 692 641 713L660 597Q664 579 666 562Q668 545 668 531Z",[],[],0],[12671,0,743,2,"M-22 269V0H58V269H-22Z M320 669Q325 618 328 564Q330 511 330 455Q330 351 286 310Q242 269 129 269H33V0H129Q224 0 308 35Q393 70 452 134Q482 94 523 64Q564 34 618 17Q672 0 740 0H763V269H742Q686 269 650 285Q614 301 595 335Q577 369 574 421L554 697L320 669Z",["M342 -134 177 -298 342 -464 507 -298 342 -134Z","M4 -134 -159 -298 4 -464 171 -298 4 -134Z"],[[177,-464,507,-134],[-159,-464,171,-134]],0],[13414,0,1019,1,"M540 657Q572 657 606 634Q641 611 666 578Q690 545 690 512Q690 472 668 434Q645 395 611 364Q577 334 542 316Q512 332 478 363Q443 394 420 433Q396 471 396 510Q396 543 420 577Q443 611 476 634Q510 657 540 657Z M929 512Q929 590 897 661Q864 733 809 791Q754 848 684 882Q614 915 539 915Q466 915 397 881Q329 848 275 790Q221 733 189 661Q157 590 157 514Q157 470 166 429Q174 388 192 349Q210 310 238 271Q215 270 196 270Q178 269 161 269Q145 269 127 269H-20V0H154Q209 0 274 10Q340 20 408 38Q476 55 539 77Q601 56 667 38Q733 21 796 11Q859 0 911 0H1039V269H943Q930 269 915 269Q900 269 883 269Q866 269 846 270Q875 309 893 347Q911 386 920 427Q929 467 929 512Z",["M705 1360 540 1195 705 1029 870 1195 705 1360Z","M367 1360 204 1195 367 1029 534 1195 367 1360Z"],[[540,1029,870,1360],[204,1029,534,1360]],0],[14433,0,624,0,"M-21 269V0H27V269H-21Z M160 0Q303 0 386 60Q469 120 504 223Q539 327 539 458Q539 539 528 628Q517 718 498 809L253 746Q269 669 285 590Q300 510 300 443Q300 367 270 318Q241 269 160 269H0V0H160Z",["M185 -125 12 -298 185 -471 358 -298 185 -125Z"],[[12,-471,358,-125]],0]]},"done":{"t":"انجام شد.","w":8224,"upem":2048,"asc":2100,"desc":-1100,"g":[[0,0,611,8,"M131 168Q131 96 182 48Q232 0 306 0Q378 0 429 48Q479 96 479 168Q479 239 428 287Q378 335 306 335Q234 335 183 287Q131 239 131 168Z",[],[],5],[611,0,1110,7,"M657 419Q657 362 611 328Q566 295 493 280Q420 266 337 266Q279 266 213 274Q147 282 85 296V28Q147 13 207 7Q268 1 352 1Q453 1 533 19Q613 36 677 71Q740 106 789 156Q824 109 865 74Q905 39 958 19Q1012 0 1088 0H1130V269H1088Q1041 269 1010 301Q979 333 953 391Q927 449 894 526L650 1092L428 985L621 554Q634 526 645 485Q657 444 657 419Z",[],[],4],[1721,0,1635,6,"M677 0Q763 0 829 37Q894 73 946 133Q987 75 1048 38Q1109 0 1200 0Q1333 0 1408 66Q1484 131 1516 237Q1549 343 1549 463Q1549 549 1536 636Q1523 722 1503 799L1262 733Q1268 709 1280 660Q1292 611 1301 553Q1311 494 1311 438Q1311 392 1301 354Q1290 315 1266 292Q1241 269 1199 269Q1131 269 1102 308Q1073 348 1069 413L1048 672L814 643Q817 605 820 563Q823 521 825 487Q826 453 826 438Q826 346 797 307Q767 269 679 269Q606 269 570 306Q533 343 528 413L507 672L273 643Q276 605 279 564Q282 522 284 488Q285 454 285 438Q285 366 264 330Q242 293 196 281Q150 269 74 269H-20V0H72Q192 0 267 35Q342 70 396 131Q438 71 506 35Q573 0 677 0Z",["M891 1406 735 1250 891 1094 1047 1250 891 1406Z","M1065 1151 909 995 1065 839 1221 995 1065 1151Z","M717 1151 561 995 717 839 873 995 717 1151Z"],[[735,1094,1047,1406],[909,839,1221,1151],[561,839,873,1151]],4],[3356,0,516,5,"",[],[],3],[3872,0,1259,4,"M936 366Q936 319 913 284Q891 248 838 248Q811 248 772 260Q733 272 687 292Q640 311 590 333Q602 369 619 406Q636 442 658 473Q681 503 710 522Q739 540 774 540Q823 540 859 516Q895 492 916 452Q936 412 936 366Z M354 374Q262 358 206 307Q151 256 123 176Q96 95 87 -11Q78 -117 78 -245Q78 -337 82 -435Q86 -532 92 -637H346Q344 -600 339 -539Q335 -478 332 -402Q329 -325 329 -243Q329 -163 333 -98Q336 -33 346 13Q355 60 371 84Q388 109 414 109Q444 109 492 90Q540 71 598 47Q657 22 718 3Q779 -16 834 -16Q946 -16 1022 36Q1097 88 1135 174Q1173 261 1173 365Q1173 495 1122 592Q1071 690 981 744Q891 798 770 798Q692 798 626 765Q561 731 509 672Q457 613 419 537Q380 461 354 374Z",[],[],2],[5131,0,563,3,"M139 1397V456Q139 226 240 113Q341 0 558 0H583V269H558Q459 269 424 315Q390 362 390 475V1397H139Z",[],[],1],[5694,0,1396,2,"M1319 640Q1238 642 1149 669Q1059 695 969 734Q878 773 793 811Q708 850 635 875Q562 901 507 901Q377 901 279 827Q182 752 113 639L74 575L284 473L332 533Q362 572 406 606Q450 640 506 640Q524 640 560 629Q596 618 648 598Q699 578 764 552Q828 527 904 499Q789 444 694 401Q599 358 512 328Q426 299 339 284Q251 269 150 269H-20V0H147Q287 0 415 30Q543 61 666 114Q789 167 914 233Q939 144 995 93Q1052 42 1142 21Q1233 0 1357 0H1416V269H1361Q1296 269 1240 273Q1183 278 1146 291Q1108 304 1098 329Q1147 350 1206 371Q1265 391 1319 396V640Z",["M666 -125 493 -298 666 -471 839 -298 666 -125Z"],[[493,-471,839,-125]],1],[7090,0,604,1,"M140 0Q283 0 366 60Q449 120 484 223Q519 327 519 458Q519 539 508 628Q497 718 478 809L233 746Q249 669 265 590Q280 510 280 443Q280 367 250 318Q221 269 140 269H-20V0H140Z",["M258 1280 85 1107 258 934 432 1107 258 1280Z"],[[85,934,432,1280]],1],[7694,0,530,0,"M390 1397H140V1H390V1397Z",[],[],0]]},"paws":{"t":"پیامرسان","w":7551,"upem":2048,"asc":2100,"desc":-1100,"g":[[0,0,1435,8,"M713 -156Q572 -156 491 -108Q410 -60 376 20Q342 100 342 196Q342 284 367 385Q392 486 429 592L186 685Q137 559 111 432Q85 304 85 185Q85 6 152 -136Q219 -277 359 -360Q498 -442 713 -442Q922 -442 1065 -364Q1207 -286 1280 -141Q1353 3 1353 202Q1353 333 1330 459Q1307 586 1250 736L983 636Q1026 531 1061 417Q1095 303 1095 195Q1095 94 1060 15Q1025 -64 941 -110Q858 -156 713 -156Z",["M700 944 521 764 700 584 881 764 700 944Z"],[[521,584,881,944]],5],[1435,0,570,7,"M136 1402V464Q136 232 239 116Q341 0 565 0H590V289H565Q467 289 436 335Q406 381 406 488V1402H136Z",[],[],4],[2005,0,1480,6,"M677 0Q765 0 829 37Q894 74 945 128Q987 74 1049 37Q1110 0 1200 0Q1336 0 1413 67Q1490 134 1523 242Q1556 351 1556 475Q1556 563 1543 652Q1530 741 1510 821L1251 750Q1258 728 1270 678Q1282 628 1293 568Q1303 507 1303 450Q1303 406 1293 370Q1284 333 1261 311Q1238 289 1198 289Q1134 289 1108 325Q1081 360 1077 422L1056 692L805 661Q808 625 811 580Q815 535 816 498Q818 460 818 446Q818 358 790 324Q762 289 679 289Q610 289 576 323Q541 356 536 422L515 692L264 661Q267 625 270 581Q274 536 275 499Q277 461 277 446Q277 377 257 344Q236 310 192 300Q147 289 74 289H-20V0H72Q189 0 264 34Q340 68 395 126Q439 69 507 34Q575 0 677 0Z",[],[],4],[3485,0,752,5,"M48 -546Q237 -508 378 -415Q518 -321 596 -170Q673 -20 673 190Q673 306 652 432Q632 557 593 667L323 580Q356 482 385 368Q414 254 414 164Q414 28 357 -59Q301 -145 196 -196Q91 -247 -54 -278L48 -546Z",[],[],3],[4237,0,0,4,"",[],[],2],[4237,0,1268,3,"M932 383Q932 338 913 303Q893 268 844 268Q815 268 777 280Q738 292 694 311Q650 329 605 349Q616 381 632 415Q648 448 670 477Q691 505 719 523Q746 540 779 540Q825 540 860 518Q894 495 913 459Q932 423 932 383Z M353 392Q261 376 205 326Q148 276 120 195Q92 115 82 7Q73 -100 73 -232Q73 -326 77 -428Q82 -529 87 -637H362Q359 -607 355 -544Q350 -480 347 -399Q343 -317 343 -232Q343 -159 347 -97Q350 -35 358 11Q366 57 381 83Q395 109 418 109Q447 109 495 90Q544 71 603 47Q663 22 724 3Q785 -16 839 -16Q953 -16 1030 38Q1108 93 1147 183Q1186 273 1186 381Q1186 513 1135 611Q1083 709 991 763Q899 818 775 818Q696 818 630 783Q563 748 511 688Q458 628 418 552Q379 476 353 392Z",[],[],1],[5505,0,570,2,"M136 1402V464Q136 232 239 116Q341 0 565 0H590V289H565Q467 289 436 335Q406 381 406 488V1402H136Z",[],[],0],[6075,0,743,1,"M-22 289V0H58V289H-22Z M312 687Q316 634 319 578Q322 522 322 464Q322 364 281 327Q239 289 129 289H33V0H129Q223 0 307 34Q391 69 451 130Q482 91 524 62Q566 33 620 17Q674 0 740 0H763V289H742Q688 289 654 304Q620 318 602 350Q585 382 582 432L562 718L312 687Z",["M342 -128 171 -298 342 -470 513 -298 342 -128Z","M4 -128 -166 -298 4 -470 176 -298 4 -128Z"],[[171,-470,513,-128],[-166,-470,176,-128]],0],[6818,0,733,0,"M-20 289V0H126V289H-20Z M263 0Q411 0 495 61Q580 123 615 229Q651 334 651 468Q651 552 640 644Q628 736 609 831L347 763Q364 686 380 605Q397 524 397 457Q397 384 368 336Q340 289 264 289H104V0H263Z",["M239 -355 78 -516 239 -677 400 -516 239 -355Z","M414 -99 253 -260 414 -421 575 -260 414 -99Z","M65 -99 -96 -260 65 -421 226 -260 65 -99Z"],[[78,-677,400,-355],[253,-421,575,-99],[-96,-421,226,-99]],0]]}};
assets/sketches/sketches.js · Bundled script · 703 lines
- /*
- * persian-motion-director: the eight technique sketches.
- *
- * Every sketch is a factory: call it to get { duration, fps, still, mount(el), render(t) }.
- * mount() builds the DOM inside a stage element (16:9); render(t) draws the moment t
- * seconds into the loop. Nothing reads the clock, so the same code runs live in a page
- * (see gallery.html) and frame-exact inside Remotion (see ../remotion).
- *
- * Persian text is either live text in elements that keep letters joined, or outlines
- * shaped ahead of time with HarfBuzz (scripts/shape_persian.py -> glyphs.js), split into
- * letter bodies and dots.
- */
- import { M } from './engine.js';
- import { GLYPHS } from './glyphs.js';
- let uidCount = 0;
- const uid = (p) => `pmd-${p}-${++uidCount}-`;
- const SVGNS = 'http://www.w3.org/2000/svg';
- const h = (tag, attrs = {}, parent) => {
- const el = document.createElementNS(SVGNS, tag);
- for (const k in attrs) el.setAttribute(k, attrs[k]);
- if (parent) parent.appendChild(el);
- return el;
- };
- const svgStage = (stage, bg) => {
- const svg = h('svg', { viewBox: '0 0 1600 900', preserveAspectRatio: 'xMidYMid slice' });
- h('rect', { width: 1600, height: 900, fill: bg }, svg);
- stage.appendChild(svg);
- return svg;
- };
- /* Words in logical order from shaped glyphs (glyphs arrive in visual order, LTR). */
- function wordsOf(run) {
- const words = [];
- let cur = [];
- for (let i = run.g.length - 1; i >= 0; i--) { // walk right -> left = logical order
- const g = run.g[i];
- if (!g[4] && !g[5].length) { if (cur.length) words.push(cur); cur = []; continue; }
- cur.push(i);
- }
- if (cur.length) words.push(cur);
- return words;
- }
- /* Shaped phrase with per-word RTL wipes. Glyph 0 is the leftmost glyph (the period). */
- function buildPhrase(defs, parent, run, { S, x0, base, fill, id, splitPeriod = false }) {
- const g = h('g', { transform: `translate(${x0} ${base}) scale(${S} ${-S})` }, parent);
- const words = wordsOf(run).map((idxs, wi) => {
- const own = splitPeriod ? idxs.filter(i => i !== 0) : idxs;
- const xs = own.map(i => run.g[i][0]), xe = own.map(i => run.g[i][0] + run.g[i][2]);
- const a = Math.min(...xs) - 80, b = Math.max(...xe) + 80;
- const clip = h('clipPath', { id: `${id}w${wi}` }, defs);
- const rect = h('rect', { x: a, y: -1500, width: b - a, height: 4200 }, clip);
- const wg = h('g', { 'clip-path': `url(#${id}w${wi})` }, g);
- const body = h('g', {}, wg);
- own.forEach(i => {
- const [gx, gy, , , d, ds] = run.g[i];
- const all = [d, ...ds].filter(Boolean).join(' ');
- if (all) h('path', { d: all, transform: `translate(${gx} ${gy})`, fill }, body);
- });
- return { rect, body, a, b };
- });
- let period = null;
- if (splitPeriod) {
- const [gx, gy, , , d] = run.g[0];
- period = h('path', { d, transform: `translate(${gx} ${gy})`, fill }, g);
- }
- // in: 0..1 per word (logical order), out: 0..1 per word
- const set = (pin, pout = () => 0) => words.forEach((w, i) => {
- const vi = pin(i), vo = pout(i), wd = w.b - w.a;
- const vis = wd * vi, cut = wd * vo;
- w.rect.setAttribute('x', w.b - vis);
- w.rect.setAttribute('width', Math.max(0, vis - cut));
- w.body.setAttribute('transform', `translate(${(1 - vi) * 300} 0)`);
- });
- // period centre in stage coordinates
- const pc = () => {
- const [gx, gy, , , , , ] = run.g[0];
- return { x: x0 + S * (gx + 305), y: base - S * (gy + 168), r: S * 174 };
- };
- return { g, set, period, pc, words };
- }
- /* Nuqta: letter bodies arrive first, right to left; dots drop in after. */
- const nuqta = () => {
- const U = uid('nuqta');
- const run = GLYPHS.nuqta, S = 1180 / run.w, X0 = (1600 - 1180) / 2, BASE = 520;
- const INK = 'var(--ink)', PAPER = 'var(--paper)';
- let words, wordEls = [], dots = [], group;
- const r = M.rng(11);
- const duration = 5.2;
- function mount(stage) {
- const svg = svgStage(stage, PAPER);
- const defs = h('defs', {}, svg);
- group = h('g', {}, svg);
- const inner = h('g', { transform: `translate(${X0} ${BASE}) scale(${S} ${-S})` }, group);
- words = wordsOf(run);
- words.forEach((idxs, wi) => {
- const xs = idxs.map(i => run.g[i][0]), xe = idxs.map(i => run.g[i][0] + run.g[i][2]);
- const x0 = Math.min(...xs) - 60, x1 = Math.max(...xe) + 60;
- const clip = h('clipPath', { id: `${U}w${wi}` }, defs);
- const rect = h('rect', { x: x0, y: -1400, width: x1 - x0, height: 4000 }, clip);
- const wg = h('g', { 'clip-path': `url(#${U}w${wi})` }, inner);
- const body = h('g', {}, wg);
- idxs.forEach(i => {
- const [gx, gy, , , d] = run.g[i];
- if (d) h('path', { d, transform: `translate(${gx} ${gy})`, fill: INK }, body);
- });
- wordEls.push({ rect, body, x0, x1 });
- idxs.forEach(i => {
- const [gx, gy, , , , ds, bs] = run.g[i];
- ds.forEach((d, k) => {
- const b = bs[k];
- const g = h('g', {}, inner);
- const p = h('path', { d, fill: INK }, g);
- const above = (b[1] + b[3]) / 2 > 300;
- dots.push({ g, p, gx, gy, b, above, word: wi, x: gx + (b[0] + b[2]) / 2 });
- });
- });
- });
- // dots land right -> left, with a little human jitter
- dots.sort((a, b) => b.x - a.x).forEach((d, i) => { d.delay = i * 0.055 + (r() - 0.5) * 0.03; });
- }
- const reveal = (t, start) => M.ease.out(M.remap(t, start, start + 0.75));
- const hide = (t, start) => M.ease.snap(M.remap(t, start, start + 0.6));
- function render(t) {
- const breathe = 1 + 0.014 * M.ease.inOut(M.remap(t, 1.6, 4.4));
- group.setAttribute('transform', `translate(800 450) scale(${breathe}) translate(-800 -450)`);
- wordEls.forEach((w, wi) => {
- const pin = reveal(t, 0.12 + wi * 0.24);
- const pout = hide(t, 4.25 + wi * 0.1);
- const width = w.x1 - w.x0;
- // RTL wipe: grow from the right edge leftward, then exit leftward
- const vis = width * pin;
- const cut = width * pout;
- w.rect.setAttribute('x', w.x1 - vis);
- w.rect.setAttribute('width', Math.max(0, vis - cut));
- w.body.setAttribute('transform', `translate(${(1 - pin) * 260} 0)`);
- });
- const fallStart = 0.95;
- for (const d of dots) {
- const t0 = fallStart + d.delay, T = 0.26;
- const lt = t - t0;
- let y = 0, sx = 1, sy = 1, op = 1;
- const H = d.above ? 1500 : -1150; // font units, y-up
- if (lt < 0) { op = 0; }
- else if (lt < T) { // accelerate like it's dropped
- const p = lt / T;
- y = H * (1 - p * p);
- op = M.clamp(p * 3);
- sy = 1 + 0.25 * p; sx = 1 - 0.12 * p; // stretch on the way down
- } else { // squash on landing, settle
- const u = lt - T;
- const k = Math.exp(-u * 16) * Math.cos(u * 34);
- sy = 1 - 0.34 * k; sx = 1 + 0.26 * k;
- y = (d.above ? 1 : -1) * 70 * Math.max(0, Math.sin(Math.min(1, u / 0.16) * Math.PI)) * Math.exp(-u * 6);
- }
- // exit: dots leave first, lifting away
- const e = M.ease.in(M.remap(t, 4.0 + (1 - d.x / run.w) * 0.25, 4.3 + (1 - d.x / run.w) * 0.25));
- y += (d.above ? 1 : -1) * 900 * e; op *= 1 - e;
- const ax = (d.b[0] + d.b[2]) / 2, ay = d.above ? d.b[1] : d.b[3];
- d.g.setAttribute('transform',
- `translate(${d.gx} ${d.gy + y}) translate(${ax} ${ay}) scale(${sx} ${sy}) translate(${-ax} ${-ay})`);
- d.g.setAttribute('opacity', op.toFixed(3));
- }
- }
- return { duration, fps: 24, still: 2.4, mount, render };
- };
- /* Kashida: the joining stroke between م and س is pulled out like a pen stroke,
- measured in rhombic dots (the calligrapher's unit), then springs back. */
- const kashida = () => {
- const U = uid('kashida');
- const run = GLYPHS.hermes, bar = GLYPHS.kashida.g[1]; // tatweel glyph: a baseline bar
- const barD = bar[4]; // M-20 289V0H585V289H-20Z at wght 800
- const S = 0.105, BASE = 560, DOT = 330, MAXL = 3300;
- const duration = 4.8;
- let svg, word, left, right, barEl, ruler = [], rulerG;
- function mount(stage) {
- svg = svgStage(stage, 'var(--ink)');
- word = h('g', {}, svg);
- const inner = h('g', { transform: `scale(${S} ${-S})` }, word);
- left = h('g', {}, inner); // س (visual index 0)
- right = h('g', {}, inner); // م ر ه
- run.g.forEach((g, i) => {
- const [gx, gy, , , d] = g;
- h('path', { d, transform: `translate(${gx} ${gy})`, fill: 'var(--paper)' }, i === 0 ? left : right);
- });
- barEl = h('rect', { y: 0, height: 289, fill: 'var(--paper)' }, inner);
- rulerG = h('g', {}, inner);
- for (let i = 0; i < 12; i++) {
- const s = 150;
- ruler.push(h('path', { d: `M0 ${-s}L${s} 0L0 ${s}L${-s} 0Z`, fill: 'var(--spot)' }, rulerG));
- }
- }
- // pull: slow start, decisive middle, long settle. release: spring back with a little overshoot.
- const pull = M.bez(0.65, 0, 0.12, 1);
- const back = M.spring({ k: 210, c: 15 });
- function render(t) {
- let L;
- if (t < 0.5) L = 0;
- else if (t < 2.0) L = MAXL * pull(M.remap(t, 0.5, 2.0));
- else if (t < 3.3) L = MAXL;
- else L = MAXL * (1 - back(t - 3.3));
- const sx = run.g[0][2]; // س advance: the joint sits at x = sx
- const W = run.w + L;
- const x0 = (1600 - W * S) / 2;
- word.setAttribute('transform', `translate(${x0} ${BASE})`);
- right.setAttribute('transform', `translate(${L} 0)`);
- barEl.setAttribute('x', sx - 20);
- barEl.setAttribute('width', Math.max(0, L + 40));
- const n = Math.floor((L + 1) / DOT);
- ruler.forEach((p, i) => {
- const on = i < n;
- const age = on ? M.clamp((L - i * DOT) / DOT) : 0;
- const sc = on ? 0.6 + 0.4 * M.ease.out(age) : 0;
- p.setAttribute('transform', `translate(${sx + DOT * (i + 0.5)} -700) scale(${sc})`);
- p.setAttribute('opacity', on ? 1 : 0);
- });
- }
- return { duration, fps: 24, still: 2.6, mount, render };
- };
- /* On twos + line boil: every drawing holds for 2 frames at 24 fps and its lines
- re-wobble 12 times a second (3 cycling seeds, like redrawn cels). The camera
- drift stays smooth, which is how hand-drawn work sits inside a modern edit. */
- const boil = () => {
- const U = uid('boil');
- const duration = 5.0;
- let cam, turb, plane, trail, speed, word, under, underLen, clipR, tw = 0, tl = 0;
- const uidb = U;
- const P = u => { // flight path: right -> left, one loop, glide down
- const x = 1720 - 1330 * u;
- const loopC = 0.42, k = Math.exp(-Math.pow((u - loopC) / 0.085, 2));
- const a = (u - loopC) * 37;
- return {
- x: x + k * 120 * Math.sin(a),
- y: 300 - 120 * Math.sin(u * Math.PI * 0.9) + 210 * u * u - k * 120 * (1 - Math.cos(a)),
- };
- };
- function mount(stage) {
- const svg = svgStage(stage, 'var(--paper)');
- const defs = h('defs', {}, svg);
- const f = h('filter', { id: uidb, x: '-5%', y: '-5%', width: '110%', height: '110%' }, defs);
- turb = h('feTurbulence', { type: 'fractalNoise', baseFrequency: '0.022', numOctaves: 2, seed: 1, result: 'n' }, f);
- h('feDisplacementMap', { in: 'SourceGraphic', in2: 'n', scale: 6, xChannelSelector: 'R', yChannelSelector: 'G' }, f);
- const clip = h('clipPath', { id: uidb + 'c' }, defs);
- clipR = h('rect', { x: 0, y: 0, width: 0, height: 900 }, clip);
- cam = h('g', {}, svg);
- const drawn = h('g', { filter: `url(#${uidb})` }, cam);
- trail = h('path', { fill: 'none', stroke: 'var(--ink)', 'stroke-width': 5, 'stroke-dasharray': '3 22', 'stroke-linecap': 'round' }, drawn);
- speed = h('g', { stroke: 'var(--ink)', 'stroke-width': 4, 'stroke-linecap': 'round' }, drawn);
- [0, 1, 2].forEach(i => h('line', { x1: 0, y1: (i - 1) * 26, x2: 70 + i * 18, y2: (i - 1) * 26 }, speed));
- plane = h('g', {}, drawn);
- const s = { fill: 'var(--paper)', stroke: 'var(--ink)', 'stroke-width': 6, 'stroke-linejoin': 'round' };
- h('path', { d: 'M-120 0 L100 -70 L30 10 Z', ...s }, plane);
- h('path', { d: 'M-120 0 L30 10 L-10 66 Z', ...s }, plane);
- h('path', { d: 'M30 10 L100 -70', fill: 'none', stroke: 'var(--ink)', 'stroke-width': 5 }, plane);
- const tg = h('g', { 'clip-path': `url(#${uidb}c)` }, drawn);
- word = h('text', { x: 860, y: 690, 'text-anchor': 'middle', direction: 'rtl', class: 'svg-fa', 'font-size': 128, 'font-weight': 800, fill: 'var(--ink)' }, tg);
- word.textContent = 'پیامت رسید.';
- under = h('path', { fill: 'none', stroke: 'var(--spot)', 'stroke-width': 9, 'stroke-linecap': 'round' }, drawn);
- }
- function measure() {
- if (tw) return;
- const b = word.getBBox();
- if (b.width > 10) { tw = b.width; tl = b.x; }
- const x1 = tl + tw, x0 = tl;
- under.setAttribute('d', `M${x1} 740 C ${x1 - tw * 0.3} 728, ${x0 + tw * 0.55} 756, ${x0 + tw * 0.2} 742 S ${x0 - 10} 736, ${x0 - 20} 744`);
- underLen = under.getTotalLength ? under.getTotalLength() : tw;
- under.setAttribute('stroke-dasharray', underLen);
- }
- function render(t) {
- measure();
- cam.setAttribute('transform', `translate(800 450) scale(${1 + 0.025 * t / duration}) translate(${-800 + 10 * Math.sin(t * 0.8)} -450)`);
- const ts = M.steps(t, 24, 2); // drawings on twos
- turb.setAttribute('seed', 1 + (Math.floor(ts * 12) % 3));
- const u = M.bez(0.3, 0, 0.35, 1)(M.remap(ts, 0.25, 2.55));
- const p = P(u), q = P(Math.max(0, u - 0.008));
- const ang = Math.atan2(p.y - q.y, p.x - q.x) * 180 / Math.PI + 180;
- const v = Math.hypot(p.x - q.x, p.y - q.y);
- const out = M.remap(ts, 4.3, 4.6);
- plane.setAttribute('transform', `translate(${p.x} ${p.y - 40 * out}) rotate(${u > 0 ? ang : 0}) scale(${1 - 0.15 * out})`);
- plane.setAttribute('opacity', (1 - out).toFixed(2));
- speed.setAttribute('transform', `translate(${p.x + 140} ${p.y}) rotate(${u > 0 ? ang : 0} -140 0)`);
- speed.setAttribute('opacity', v > 9 && u < 0.95 ? 1 : 0);
- let d = '';
- const n = Math.floor(u * 90);
- for (let i = 0; i <= n; i++) { const r = P(i / 90); d += `${i ? 'L' : 'M'}${r.x.toFixed(1)} ${r.y.toFixed(1)}`; }
- trail.setAttribute('d', d);
- trail.setAttribute('opacity', (1 - M.remap(ts, 3.6, 4.2)).toFixed(2));
- // words wipe in right to left, on twos
- const wi = M.remap(ts, 2.35, 2.9), wo = M.remap(ts, 4.35, 4.75);
- const x1 = (tl + tw) || 1300, w = tw || 900;
- clipR.setAttribute('x', x1 + 30 - (w + 60) * wi);
- clipR.setAttribute('width', Math.max(0, (w + 60) * (wi - wo)));
- const ul = M.ease.out(M.remap(ts, 2.95, 3.5));
- under.setAttribute('stroke-dashoffset', ((underLen || 1) * (1 - ul)).toFixed(1));
- under.setAttribute('opacity', (1 - wo).toFixed(2));
- }
- return { duration, fps: 24, still: 3.7, mount, render };
- };
- /* Match cut: the full stop grows into Hermes' reply bubble, then shrinks into
- the full stop of the next line. No cut, no fade-to-black. */
- const match = () => {
- const U = uid('match');
- const duration = 6.2, S = 0.074;
- let A, B, D, cam, blob, typing, tick, tickLen, bubbleG, tail;
- function mount(stage) {
- const svg = svgStage(stage, 'var(--paper)');
- const defs = h('defs', {}, svg);
- cam = h('g', {}, svg);
- A = buildPhrase(defs, cam, GLYPHS.sendA, { S, x0: (1600 - GLYPHS.sendA.w * S) / 2, base: 482, fill: 'var(--ink)', id: U + 'mA', splitPeriod: true });
- B = buildPhrase(defs, cam, GLYPHS.restB, { S, x0: (1600 - GLYPHS.restB.w * S) / 2, base: 482, fill: 'var(--ink)', id: U + 'mB', splitPeriod: true });
- bubbleG = h('g', {}, svg);
- tail = h('path', { d: 'M0 0 L46 0 L0 40 Z', fill: 'var(--ink)' }, bubbleG);
- blob = h('rect', { fill: 'var(--ink)' }, bubbleG);
- typing = [0, 1, 2].map(i => h('circle', { r: 13, fill: 'var(--paper)' }, bubbleG));
- D = buildPhrase(defs, bubbleG, GLYPHS.done, { S: 0.06, x0: 800 - GLYPHS.done.w * 0.06 / 2 + 40, base: 488, fill: 'var(--paper)', id: U + 'mD' });
- tick = h('path', { d: 'M0 0 L22 22 L62 -26', fill: 'none', stroke: 'var(--paper)', 'stroke-width': 11, 'stroke-linecap': 'round', 'stroke-linejoin': 'round' }, bubbleG);
- tickLen = 31 + 62.5;
- tick.setAttribute('stroke-dasharray', tickLen);
- }
- const grow = M.bez(0.75, 0, 0.2, 1), settle = M.spring({ k: 260, c: 20 });
- const shrink = M.bez(0.6, 0, 0.15, 1);
- function render(t) {
- const pa = A.pc(), pb = B.pc();
- // sentence A in, then pushed aside as the camera follows the dot
- A.set(i => M.ease.out(M.remap(t, 0.1 + i * 0.18, 0.8 + i * 0.18)));
- const aOut = M.ease.snap(M.remap(t, 1.35, 1.95));
- A.g.parentNode === cam && A.g.setAttribute('opacity', 1 - aOut);
- A.g.setAttribute('transform', `translate(${(1600 - GLYPHS.sendA.w * S) / 2 + 220 * aOut} 482) scale(${S} ${-S})`);
- A.period.setAttribute('opacity', t < 1.3 && t > 0.7 ? 1 : 0);
- A.period.setAttribute('transform', `translate(0 0) scale(${M.ease.out(M.remap(t, 0.7, 0.95))})`);
- // B arrives as the dot lands, leaves at the end of the loop
- B.set(i => M.ease.out(M.remap(t, 3.95 + i * 0.15, 4.6 + i * 0.15)),
- i => M.ease.snap(M.remap(t, 5.6 + i * 0.08, 6.1 + i * 0.08)));
- B.period.setAttribute('opacity', t > 4.42 && t < 5.75 ? 1 : 0);
- // the travelling shape: x, y, w, h, rx
- let x = pa.x, y = pa.y, w = pa.r * 2, hh = pa.r * 2, op = 0;
- if (t >= 1.3 && t < 1.45) { // anticipation: dip + squash
- const p = M.ease.inOut(M.remap(t, 1.3, 1.45));
- y = pa.y + 9 * p; w = pa.r * 2 * (1 + 0.25 * p); hh = pa.r * 2 * (1 - 0.2 * p); op = 1;
- } else if (t >= 1.45 && t < 3.72) {
- op = 1;
- const g1 = grow(M.remap(t, 1.45, 2.05)); // fly + grow as a circle
- const d = 26 + (380 - 26) * g1;
- x = M.mix(pa.x, 800, g1); y = M.mix(pa.y + 9, 450, g1) - 140 * Math.sin(Math.PI * g1);
- w = hh = d;
- const g2 = settle(t - 1.95); // circle -> bubble, with overshoot
- if (t > 1.95) { w = 380 + (900 - 380) * g2; hh = 380; }
- } else if (t >= 3.72 && t < 4.45) { // bubble -> circle -> full stop of B
- op = 1;
- const s1 = M.ease.inOut(M.remap(t, 3.72, 3.92));
- w = M.mix(900, 380, s1); hh = 380;
- const s2 = shrink(M.remap(t, 3.88, 4.45));
- const dd = M.mix(380, pb.r * 2, s2);
- if (t > 3.88) { w = Math.min(w, dd); hh = dd; }
- x = M.mix(800, pb.x, s2); y = M.mix(450, pb.y, s2) - 120 * Math.sin(Math.PI * s2);
- }
- const rx = Math.min(w, hh) / 2 * (t > 1.95 && t < 3.9 ? M.mix(1, 0.34, M.clamp(w / 900 * 1.4 - 0.4)) : 1);
- blob.setAttribute('x', x - w / 2); blob.setAttribute('y', y - hh / 2);
- blob.setAttribute('width', Math.max(0, w)); blob.setAttribute('height', Math.max(0, hh));
- blob.setAttribute('rx', rx);
- blob.setAttribute('opacity', op);
- const tailOn = M.ease.out(M.remap(t, 2.25, 2.45)) * (1 - M.remap(t, 3.65, 3.75));
- tail.setAttribute('transform', `translate(${800 - 450 + 70} ${450 + 190 - 2}) scale(${tailOn})`);
- // typing dots, then the reply
- const typingOn = t > 2.3 && t < 3.0;
- typing.forEach((c, i) => {
- const b = Math.max(0, Math.sin((t - 2.3) * 9 - i * 0.9));
- c.setAttribute('cx', 830 - i * 46); c.setAttribute('cy', 452 - 14 * b);
- c.setAttribute('opacity', typingOn ? 1 : 0);
- });
- const rIn = (i) => M.ease.out(M.remap(t, 3.0 + i * 0.14, 3.5 + i * 0.14));
- const rOut = () => M.remap(t, 3.62, 3.72);
- D.set(rIn, rOut);
- D.g.setAttribute('opacity', t > 2.95 && t < 3.74 ? 1 : 0);
- const tk = M.ease.out(M.remap(t, 3.25, 3.55));
- tick.setAttribute('transform', `translate(${800 - GLYPHS.done.w * 0.06 / 2 - 60} 470)`);
- tick.setAttribute('stroke-dashoffset', tickLen * (1 - tk));
- tick.setAttribute('opacity', t > 3.2 && t < 3.72 ? 1 : 0);
- // a gentle camera push the whole time
- cam.setAttribute('transform', `translate(800 450) scale(${1 + 0.02 * Math.sin(t / duration * Math.PI)}) translate(-800 -450)`);
- }
- return { duration, fps: 60, still: 3.45, mount, render };
- };
- /* One continuous camera: scenes live on one long strip (laid out right to left),
- and every "transition" is the camera travelling: anticipation, whip, motion blur,
- parallax layers, settle. The last scene is the first one again, so it loops. */
- const oner = () => {
- const U = uid('oner');
- const D = 2400, duration = 6.9;
- const MOVES = [1.35, 3.6, 5.85], MT = 0.72;
- const move = M.bez(0.62, -0.18, 0.18, 1.04); // small anticipation, whip, tiny overshoot
- let world, blurF, layers = [], cards = [], ring, ringLen;
- function text(parent, str, x, y, size, weight, extra = {}) {
- const el = h('text', { x, y, 'text-anchor': 'middle', direction: 'rtl', class: 'svg-fa', 'font-size': size, 'font-weight': weight, fill: 'var(--ink)', ...extra }, parent);
- el.textContent = str; return el;
- }
- function scene(k, f) {
- const g = h('g', {}, world);
- layers.push({ g, k, f });
- return g;
- }
- function wordmark(parent) {
- const run = GLYPHS.hermes, S = 0.115;
- const g = h('g', { transform: `translate(${800 - run.w * S / 2} 470) scale(${S} ${-S})` }, parent);
- run.g.forEach(([gx, gy, , , d, ds]) => { const all = [d, ...ds].filter(Boolean).join(' '); if (all) h('path', { d: all, transform: `translate(${gx} ${gy})`, fill: 'var(--ink)' }, g); });
- }
- function mount(stage) {
- const svg = svgStage(stage, 'var(--paper)');
- const defs = h('defs', {}, svg);
- const f = h('filter', { id: U + 'blur', x: '-20%', y: '-5%', width: '140%', height: '110%' }, defs);
- blurF = h('feGaussianBlur', { stdDeviation: '0 0' }, f);
- world = h('g', { filter: `url(#${U}blur)` }, svg);
- [0, 3].forEach(k => { // scene 1 and its loop twin
- h('circle', { cx: 1140, cy: 290, r: 330, fill: 'var(--ink)', opacity: 0.05 }, scene(k, 0.5));
- const m = scene(k, 1);
- wordmark(m);
- text(m, 'دستیار همیشه بیدار', 800, 575, 44, 400);
- const fg = scene(k, 1.4);
- [0, 1, 2].forEach(i => h('circle', { cx: 330 + i * 34, cy: 700, r: 9, fill: 'var(--spot)' }, fg));
- });
- // scene 2: memory
- h('rect', { x: 150, y: 120, width: 700, height: 520, rx: 40, fill: 'var(--ink)', opacity: 0.05 }, scene(1, 0.5));
- text(scene(1, 1), 'یادش میماند', 800, 300, 96, 800);
- const cg = scene(1, 1.3);
- [[-260, -6], [0, 2], [260, 7]].forEach(([dx, rot], i) => {
- const c = h('g', {}, cg);
- h('rect', { x: -170, y: -100, width: 340, height: 200, rx: 18, fill: 'var(--paper)', stroke: 'var(--ink)', 'stroke-width': 4 }, c);
- [0, 1, 2].forEach(j => h('rect', { x: -120, y: -52 + j * 42, width: j === 2 ? 140 : 240, height: 14, rx: 7, fill: 'var(--ink)', opacity: 0.8, transform: 'scale(-1 1)' }, c));
- cards.push({ c, dx, rot, i });
- });
- // scene 3: always on
- h('circle', { cx: 520, cy: 560, r: 300, fill: 'var(--ink)', opacity: 0.05 }, scene(2, 0.5));
- const m3 = scene(2, 1);
- text(m3, '۲۴', 960, 560, 300, 800);
- text(m3, 'ساعته', 560, 560, 110, 700);
- const r3 = scene(2, 1.25);
- ring = h('circle', { cx: 960, cy: 455, r: 250, fill: 'none', stroke: 'var(--spot)', 'stroke-width': 10, 'stroke-linecap': 'round', transform: 'rotate(-90 960 455)' }, r3);
- ringLen = 2 * Math.PI * 250;
- ring.setAttribute('stroke-dasharray', ringLen);
- }
- function camAt(t) {
- let x = 0;
- MOVES.forEach(m => { x += move(M.remap(t, m, m + MT)); });
- return -x * D; // camera travels left
- }
- function render(t) {
- const camX = camAt(t), v = (camX - camAt(t - 1 / 60)) * 60;
- const speed = Math.abs(v) / D; // scenes per second
- let dip = 0;
- MOVES.forEach(m => { dip = Math.max(dip, Math.sin(Math.PI * M.remap(t, m, m + MT))); });
- const sc = 1 - 0.06 * dip, lean = -1.2 * Math.sign(v) * Math.min(1, speed / 3);
- const drift = 6 * Math.sin(t * 1.3);
- world.setAttribute('transform', `translate(800 450) rotate(${lean}) scale(${sc}) translate(-800 -450)`);
- blurF.setAttribute('stdDeviation', `${Math.min(36, speed * 7).toFixed(2)} 0`);
- for (const L of layers) {
- const off = (-L.k * D - camX) * -1; // scene k sits k*D to the left
- L.g.setAttribute('transform', `translate(${(-off * L.f + drift * L.f).toFixed(2)} 0)`);
- }
- cards.forEach(({ c, dx, rot, i }) => {
- const bob = 8 * Math.sin(t * 1.6 + i * 1.7);
- c.setAttribute('transform', `translate(${800 + dx} ${620 + bob}) rotate(${rot + Math.sin(t + i) * 1.2})`);
- });
- const p = (t % 2.25) / 2.25;
- ring.setAttribute('stroke-dashoffset', ringLen * (1 - M.ease.inOut(p)));
- }
- return { duration, fps: 60, still: 0.6, mount, render };
- };
- /* Cut on the beat: hard cuts on every beat (120 BPM), no fades. Each cut lands
- slightly punched-in and settles; off-beats get small accents. */
- const beat = () => {
- const U = uid('beat');
- const BPM = 120, BEAT = 60 / BPM, N = 8, duration = BEAT * N;
- const FR = [
- { html: '<span style="font-weight:900">هرمس</span>', size: 26, inv: false, pos: 'c' },
- { html: 'میخواند', size: 7, inv: true, pos: 'tr' },
- { html: '<span style="font-weight:900">مینویسد</span>', size: 44, inv: false, pos: 'bleed' },
- { html: 'میفرستد<br>میفرستد<br>میفرستد', size: 11, inv: false, pos: 'stack' },
- { html: 'یادش <span style="font-weight:900">میماند</span>', size: 13, inv: true, pos: 'c' },
- { html: 'همیشه', size: 20, inv: false, pos: 'c', flick: true },
- { html: 'بیدار', size: 20, inv: false, pos: 'c', flick: true },
- { html: '<span style="font-weight:900">هرمس</span>', size: 9, inv: true, pos: 'bl' },
- ];
- let frames = [], ticks = [], acc;
- function mount(stage) {
- const root = document.createElement('div');
- root.className = 'beat-root';
- FR.forEach(f => {
- const d = document.createElement('div');
- d.className = `beat-fr beat-${f.pos}` + (f.inv ? ' inv' : '');
- d.innerHTML = `<p dir="rtl" lang="fa" style="font-size:${f.size}cqw">${f.html}</p>`;
- root.appendChild(d); frames.push(d);
- });
- acc = document.createElement('i'); acc.className = 'beat-acc'; root.appendChild(acc);
- const tk = document.createElement('div'); tk.className = 'beat-ticks';
- for (let i = 0; i < N; i++) { const s = document.createElement('i'); tk.appendChild(s); ticks.push(s); }
- root.appendChild(tk);
- stage.appendChild(root);
- }
- function render(t) {
- const b = Math.floor(t / BEAT) % N, u = (t % BEAT) / BEAT;
- frames.forEach((f, i) => { f.hidden = i !== b; });
- const f = frames[b], spec = FR[b];
- const punch = 1 + 0.07 * (1 - M.ease.out(M.remap(u, 0, 0.45)));
- f.style.transform = `scale(${punch.toFixed(4)})`;
- if (spec.flick) {
- const p = f.querySelector('p');
- p.style.fontVariationSettings = `'wght' ${u < 0.5 ? 300 : 900}`;
- }
- // off-beat accent: a bar that snaps across on the "and"
- const a = M.remap(u, 0.5, 0.62);
- acc.style.opacity = u > 0.5 && u < 0.7 ? 1 : 0;
- acc.style.transform = `translateX(${(-a * 100).toFixed(1)}%)`;
- ticks.forEach((s, i) => s.classList.toggle('on', i === b));
- frames[b].parentNode.classList.toggle('dark', !!spec.inv);
- }
- return { duration, fps: 24, still: 0.3, mount, render };
- };
- /* Product UI in space: the real interface, set in 3D, with a camera dolly, a
- cursor that moves on a curve and squashes on click, and a focus pull to the
- task log behind it. RTL UI: window controls and the user's bubbles sit right. */
- const ui = () => {
- const U = uid('ui');
- const duration = 6.4;
- let root, scene, win, log, cursor, btn, ripple, mine, typing, reply, rows = [];
- function mount(stage) {
- root = document.createElement('div');
- root.className = 'ui-root';
- root.innerHTML = `
- <div class="ui-scene">
- <div class="ui-log" dir="rtl" lang="fa">
- <div class="ui-log-h">کارهای امروز</div>
- <div class="ui-row"><span>خواندن ۴۲ ایمیل</span><b>۰۹:۴۱</b></div>
- <div class="ui-row"><span>جدا کردن موارد مهم</span><b>۰۹:۴۲</b></div>
- <div class="ui-row"><span>نوشتن خلاصه</span><b>۰۹:۴۲</b></div>
- <div class="ui-row"><span>ارسال در تلگرام</span><b>۰۹:۴۳</b></div>
- </div>
- <div class="ui-win" dir="rtl" lang="fa">
- <div class="ui-bar"><i></i><i></i><i></i><span>هرمس</span></div>
- <div class="ui-chat">
- <div class="ui-msg mine">خلاصهی ایمیلهای امروز رو بفرست</div>
- <div class="ui-typing"><i></i><i></i><i></i></div>
- <div class="ui-msg theirs">سه ایمیل مهم داری. خلاصهاش رو توی تلگرام فرستادم.</div>
- </div>
- <div class="ui-input"><span>خلاصهی ایمیلهای امروز رو بفرست</span><button tabindex="-1" aria-hidden="true">ارسال</button><em></em></div>
- </div>
- </div>
- <svg class="ui-cursor" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 2l14 9.5-6.2 1.4 3.7 7.3-2.6 1.3-3.7-7.3L5 19z" fill="#111" stroke="#fff" stroke-width="1.4" stroke-linejoin="round"/></svg>`;
- stage.appendChild(root);
- scene = root.querySelector('.ui-scene');
- win = root.querySelector('.ui-win'); log = root.querySelector('.ui-log');
- cursor = root.querySelector('.ui-cursor'); btn = root.querySelector('.ui-input button');
- ripple = root.querySelector('.ui-input em');
- mine = root.querySelector('.mine'); reply = root.querySelector('.theirs'); typing = root.querySelector('.ui-typing');
- rows = [...root.querySelectorAll('.ui-row')];
- }
- // cursor path: a curve from the lower left to the send button, slight overshoot
- const C0 = [8, 96], C1 = [14, 60], C2 = [40, 88], C3 = [31.5, 74.5];
- const bezPt = (p) => [0, 1].map(k => {
- const a = C0[k], b = C1[k], c = C2[k], d = C3[k], u = 1 - p;
- return u * u * u * a + 3 * u * u * p * b + 3 * u * p * p * c + p * p * p * d;
- });
- const dolly = M.bez(0.2, 0.7, 0.1, 1), pull = M.bez(0.65, 0, 0.2, 1);
- function render(t) {
- // camera: dolly in, then swing to the log, then drift back for the loop
- const d = dolly(M.remap(t, 0, 1.4));
- const s = pull(M.remap(t, 3.3, 4.4));
- const back = M.ease.inOut(M.remap(t, 5.5, 6.4));
- const ry = M.mix(M.mix(-26, -9, d), 6, s) * (1 - back) + -26 * back;
- const rx = M.mix(M.mix(14, 5, d), 4, s) * (1 - back) + 14 * back;
- const tz = M.mix(M.mix(-260, 0, d), 60, s) * (1 - back) + -260 * back;
- const tx = M.mix(0, -42, s) * (1 - back);
- scene.style.transform = `translateX(${tx}cqw) translateZ(${tz}px) rotateX(${rx}deg) rotateY(${ry}deg)`;
- // depth of field: focus moves from the window to the log
- const fwin = 7 * s * (1 - back), flog = 7 * (1 - s) + 7 * back * s;
- win.style.filter = `blur(${(fwin / 1.6).toFixed(2)}px)`;
- log.style.filter = `blur(${(Math.min(7, flog) / 1.6).toFixed(2)}px)`;
- // cursor: enters on a curve, lands on send, clicks, leaves
- const cp = M.ease.out(M.remap(t, 0.7, 1.75));
- const [cx, cy] = bezPt(cp);
- const click = M.remap(t, 1.8, 1.95), rel = M.remap(t, 1.95, 2.15);
- const squash = 1 - 0.18 * Math.sin(Math.PI * M.clamp(click + rel * 0.0)) * (t < 2.15 ? 1 : 0);
- const leave = M.ease.in(M.remap(t, 2.5, 3.2));
- cursor.style.left = `${cx - leave * 4}%`; cursor.style.top = `${cy + leave * 30}%`;
- cursor.style.transform = `scale(${squash.toFixed(3)})`;
- cursor.style.opacity = t > 0.6 && t < 3.2 ? 1 : 0;
- btn.style.transform = `scale(${(1 - 0.08 * Math.sin(Math.PI * M.remap(t, 1.8, 2.1))).toFixed(3)})`;
- const rp = M.remap(t, 1.85, 2.4);
- ripple.style.opacity = rp > 0 && rp < 1 ? (1 - rp).toFixed(2) : 0;
- ripple.style.transform = `translate(-50%,-50%) scale(${(0.3 + 2.2 * M.ease.out(rp)).toFixed(3)})`;
- // chat: my bubble rises from the input, Hermes types, then replies
- const m = M.spring({ k: 260, c: 22 })(t - 2.0);
- mine.style.opacity = t > 2.0 ? 1 : 0;
- mine.style.transform = `translateY(${(1 - m) * 160}%) scale(${(0.92 + 0.08 * m).toFixed(3)})`;
- root.querySelector('.ui-input span').style.opacity = t > 2.0 ? 0 : 1;
- typing.style.opacity = t > 2.4 && t < 3.05 ? 1 : 0;
- [...typing.children].forEach((c, i) => { c.style.transform = `translateY(${-35 * Math.max(0, Math.sin((t - 2.4) * 10 - i * 0.9))}%)`; });
- const r = M.spring({ k: 240, c: 21 })(t - 3.05);
- reply.style.opacity = t > 3.05 ? 1 : 0;
- reply.style.transform = `scale(${(0.85 + 0.15 * r).toFixed(3)})`;
- // log rows tick in once the focus lands there
- rows.forEach((row, i) => {
- const p = M.ease.out(M.remap(t, 3.9 + i * 0.22, 4.3 + i * 0.22));
- row.style.opacity = (0.25 + 0.75 * p).toFixed(2);
- row.classList.toggle('done', p > 0.6);
- });
- }
- return { duration, fps: 60, still: 3.6, mount, render };
- };
- /* Paper cut-out: each connected letter group of پیامرسان is one rigid piece of
- black paper, pinned at the baseline and placed by hand, on threes (8 poses a
- second). One light, so every shadow agrees; a lifted piece casts a longer one. */
- const cutout = () => {
- const U = uid('cutout');
- const run = GLYPHS.paws, S = 0.158, X0 = (1600 - run.w * S) / 2, BASE = 575;
- const duration = 5.6;
- let pieces = [];
- const jit = M.rng(5);
- function mount(stage) {
- const svg = svgStage(stage, 'var(--paper)');
- const defs = h('defs', {}, svg);
- // light-table glow behind the paper
- const rg = h('radialGradient', { id: U + 'light', cx: '50%', cy: '42%', r: '65%' }, defs);
- h('stop', { offset: '0', style: 'stop-color: var(--paper); stop-opacity: 0' }, rg);
- h('stop', { offset: '1', style: 'stop-color: var(--black); stop-opacity: .07' }, rg);
- h('rect', { width: 1600, height: 900, fill: `url(#${U}light)` }, svg);
- const groups = {};
- run.g.forEach((g, i) => { if (g[4] || g[5].length) (groups[g[7]] = groups[g[7]] || []).push(i); }); // g[7]: connected letter group
- Object.keys(groups).map(Number).sort((a, b) => a - b).forEach((k, n) => {
- const idx = groups[k];
- const xs = idx.map(i => run.g[i][0]), xe = idx.map(i => run.g[i][0] + run.g[i][2]);
- const pivot = (Math.min(...xs) + Math.max(...xe)) / 2;
- const f = h('filter', { id: `${U}p${k}`, x: '-30%', y: '-30%', width: '160%', height: '170%' }, defs);
- const ds = h('feDropShadow', { dx: 5, dy: 8, stdDeviation: 3, 'flood-color': '#000', 'flood-opacity': 0.28 }, f);
- const outer = h('g', { filter: `url(#${U}p${k})` }, svg);
- const inner = h('g', {}, outer);
- const glyphs = h('g', { transform: `scale(${S} ${-S}) translate(${-pivot} 0)` }, inner);
- idx.forEach(i => { const [gx, gy, , , d, ds] = run.g[i]; h('path', { d: [d, ...ds].join(' '), transform: `translate(${gx} ${gy})`, fill: 'var(--ink)' }, glyphs); });
- pieces.push({ outer, inner, ds, n, px: X0 + pivot * S, from: { x: (jit() - 0.5) * 300, y: 520 + jit() * 120, r: (jit() - 0.5) * 70 }, j: [jit(), jit(), jit()] });
- });
- pieces.reverse(); // logical order: پیا first (rightmost)
- pieces.sort((a, b) => b.px - a.px);
- }
- const place = M.bez(0.3, 0.9, 0.3, 1.1);
- function render(t) {
- const ts = M.steps(t, 24, 3); // on threes
- const pose = Math.floor(ts * 8);
- pieces.forEach((p, i) => {
- const a = 0.3 + i * 0.32;
- const pin = place(M.remap(ts, a, a + 0.75));
- const lift = M.ease.inOut(M.remap(ts, 4.1 + i * 0.16, 4.5 + i * 0.16));
- const gone = M.ease.in(M.remap(ts, 4.45 + i * 0.16, 5.0 + i * 0.16));
- const moving = pin > 0 && pin < 1 || lift > 0;
- const r = M.rng(pose * 13 + i * 7);
- const jx = moving ? (r() - 0.5) * 3 : 0, jr = moving ? (r() - 0.5) * 1.4 : 0;
- const x = p.px + p.from.x * (1 - pin) + jx + gone * 260 * (i % 2 ? 1 : -1) * 0.4;
- const y = BASE + p.from.y * (1 - pin) - lift * 22 - gone * 700;
- const rot = p.from.r * (1 - pin) + jr + gone * (i % 2 ? 14 : -10);
- const sc = 1 + 0.04 * lift;
- p.inner.setAttribute('transform', `translate(${x.toFixed(2)} ${y.toFixed(2)}) rotate(${rot.toFixed(2)}) scale(${sc})`);
- // shadow: flat on the table vs lifted toward the light
- const L = Math.max(lift, pin < 1 ? 1 - pin : 0);
- p.ds.setAttribute('dx', (5 + 16 * L).toFixed(1));
- p.ds.setAttribute('dy', (8 + 24 * L).toFixed(1));
- p.ds.setAttribute('stdDeviation', (3 + 9 * L).toFixed(1));
- p.ds.setAttribute('flood-opacity', (0.28 - 0.1 * L).toFixed(2));
- p.outer.setAttribute('opacity', ts < a ? 0 : 1);
- });
- }
- return { duration, fps: 24, still: 3.2, mount, render };
- };
- export const SKETCHES = { oner, match, ui, beat, boil, cutout, nuqta, kashida };
- export const SKETCH_INFO = [
- { id: 'oner', n: 1, title: 'One camera, no cuts', fa: 'یک دوربین، بدون کات' },
- { id: 'match', n: 2, title: 'One shape carries the story', fa: 'یک شکل، کل داستان' },
- { id: 'ui', n: 3, title: 'The real UI, directed', fa: 'رابط واقعی، کارگردانیشده' },
- { id: 'beat', n: 4, title: 'Cut on the beat', fa: 'کات روی ضرب' },
- { id: 'boil', n: 5, title: 'On twos, with line boil', fa: 'دوفریمی، با خط لرزان' },
- { id: 'cutout', n: 6, title: 'Paper cut-out letters', fa: 'حروف کاغذی' },
- { id: 'nuqta', n: 7, title: 'Dots last', fa: 'نقطهها آخر' },
- { id: 'kashida', n: 8, title: 'Kashida, not letter-spacing', fa: 'کشیده، نه فاصله' },
- ];
scripts/lint_persian.py · Bundled script · 155 lines
- #!/usr/bin/env python3
- """Lint Persian copy and motion code for the mistakes that make Persian look "off".
- usage:
- python3 lint_persian.py copy FILE_OR_TEXT [...] check Persian copy (txt, md, json, tsx...)
- python3 lint_persian.py code PATH [...] check code for Persian layout traps
- Exit code 1 when something is found. Pure standard library.
- Copy checks: Arabic ي/ك, Arabic-Indic digits, Latin digits glued to Persian, missing
- half-spaces (می، ها، تر، ای), zero-width space used as a half-space, English punctuation
- and straight quotes in Persian, misplaced kashida (ـ), spacing around punctuation.
- Code checks: letter-spacing near Persian, per-letter boxes, missing dir="rtl", lang="ar"
- on Persian, scene-to-scene fade() transitions, default spring() configs.
- """
- import os
- import re
- import sys
- FA = r"-ۿ"
- FA_LETTER = r"ء-يٱ-ۓۺ-ۿ"
- RIGHT_JOINING = "اآأإدذرزژوؤةۀ"
- VERB_STEMS = ("کن|شو|خواه|ده|توان|گیر|رو|آی|ساز|نویس|گوی|گو|بین|دان|رس|زن|خور|مان|کش|فرست|"
- "خوان|پرس|آور|بر|دار|گذار|یاب|پذیر|سوز|ریز|ترس|خند|گرد|افت|اندیش")
- SUFFIXES = "ها|های|هایی|هایم|هایت|هایش|هایمان|هایتان|هایشان|تر|ترین"
- COPY_RULES = [
- ("arabic-yeh", re.compile("ي"), "Arabic ي (U+064A): use Persian ی (U+06CC)"),
- ("arabic-kaf", re.compile("ك"), "Arabic ك (U+0643): use Persian ک (U+06A9)"),
- ("alef-maksura", re.compile(f"ى(?=$|[^{FA_LETTER}])"), "ى at a word end: Persian uses ی (U+06CC)"),
- ("arabic-digit", re.compile("[٠-٩]"), "Arabic-Indic digit: use Persian digits ۰–۹ (U+06F0–06F9)"),
- ("latin-digit", re.compile(f"[0-9]+(?=\\s?[{FA_LETTER}])|(?<=[{FA_LETTER}]\\s)[0-9]+"), "Latin digits beside Persian words: use Persian digits unless this is a version or code"),
- ("zwsp", re.compile(""), "zero-width space (U+200B) does not stop joining: use the half-space ZWNJ (U+200C)"),
- ("mi-space", re.compile(f"(?:^|(?<=\\s))(ن?می) (?=[{FA_LETTER}])"), "می / نمی followed by a space: use a half-space (می)"),
- ("mi-glued", re.compile(f"(?:^|(?<=[\\s«(]))(ن?می)(?:{VERB_STEMS})"), "می / نمی glued to the verb: use a half-space (می)"),
- ("suffix-space", re.compile(f"(?<=[{FA_LETTER}]) (?:{SUFFIXES})(?=$|[\\s،.؟!:؛»)])"), "suffix after a full space: use a half-space (ها، تر، ترین)"),
- ("heh-ye-space", re.compile(f"(?<=ه) (?:ای|ایی)(?=$|[\\s،.؟!:؛»)])"), "ـه + ای after a space: write ـهای with a half-space"),
- ("question-mark", re.compile(f"(?<=[{FA_LETTER}])\\s?\\?"), "English ? after Persian: use ؟"),
- ("comma", re.compile(f"(?<=[{FA_LETTER}]),"), "English comma after Persian: use ،"),
- ("semicolon", re.compile(f"(?<=[{FA_LETTER}]);"), "English semicolon after Persian: use ؛"),
- ("straight-quotes", re.compile(f'"(?=[{FA_LETTER}])|(?<=[{FA_LETTER}])"'), "straight quotes around Persian: use « »"),
- ("space-before-punct", re.compile("(?<=\\S) +(?=[،.؟!؛:])"), "space before punctuation"),
- ("double-space", re.compile("(?<=\\S) +(?=\\S)"), "double space"),
- ]
- def kashida_issues(line):
- out = []
- for m in re.finditer("ـ+", line):
- i = m.start()
- prev = line[i - 1] if i > 0 else ""
- nxt = line[m.end()] if m.end() < len(line) else ""
- if not prev or prev in " " or prev in RIGHT_JOINING:
- out.append((i, "kashida", "ـ after a letter that does not join forward (or after a space/half-space)"))
- if nxt in " ":
- out.append((i, "kashida", "ـ next to a half-space or space"))
- if prev == "ل" and nxt in "اآأإ":
- out.append((i, "kashida", "ـ inside لا breaks the required lam-alef ligature"))
- for word in re.finditer(f"[{FA}ـ]+", line):
- if len(re.findall("ـ+", word.group())) > 1:
- out.append((word.start(), "kashida", "more than one kashida in a word"))
- return out
- def lint_copy_text(text, name):
- issues = []
- for ln, line in enumerate(text.splitlines(), 1):
- if not re.search(f"[{FA_LETTER}]", line):
- continue
- for code, rx, msg in COPY_RULES:
- for m in rx.finditer(line):
- issues.append((name, ln, m.start() + 1, code, msg))
- for col, code, msg in kashida_issues(line):
- issues.append((name, ln, col + 1, code, msg))
- return issues
- CODE_EXT = (".js", ".jsx", ".ts", ".tsx", ".mjs", ".css", ".html", ".vue", ".svelte")
- def lint_code_file(path):
- try:
- src = open(path, encoding="utf-8").read()
- except (UnicodeDecodeError, OSError):
- return []
- issues = []
- if "Generated by scripts/shape_persian.py" in src[:300]:
- return [] # shaped glyph data, not text
- allowed = set(re.findall(r"lint-persian:\s*allow\s+([\w-]+)", src))
- # judge Persian presence on code and strings only, not comments
- code_only = re.sub(r"/\*.*?\*/", "", src, flags=re.S)
- code_only = re.sub(r"(?m)(^|[^:'\"`])//.*$", r"\1", code_only)
- has_fa = re.search(f"[{FA_LETTER}]", code_only) is not None
- lines = src.splitlines()
- def add(ln, code, msg):
- if code not in allowed:
- issues.append((path, ln, 1, code, msg))
- for ln, line in enumerate(lines, 1):
- if re.search(r"from ['\"]@remotion/transitions/fade['\"]|\bfade\(\)", line):
- add(ln, "scene-fade", "scene-to-scene fade(): move a camera or carry an object across instead")
- if re.search(r"\bspring\(\{\s*frame\s*,\s*fps\s*\}\)", line):
- add(ln, "default-spring", "default spring() overshoots ~16%: set config {stiffness: 100, damping: 16} or similar")
- if not has_fa:
- continue
- if re.search(r"letter-spacing\s*:|letterSpacing\s*:", line) and re.search(f"[{FA_LETTER}]|rtl|fa", line):
- add(ln, "letter-spacing", "letter-spacing in a file with Persian: Chrome ignores it inside Persian words and other tools break joins; use kashida")
- if re.search(r"lang=['\"]ar['\"]", line):
- add(ln, "lang-ar", 'lang="ar" on Persian: use lang="fa" (digits and forms differ)')
- if has_fa:
- splits = re.search(r"\.split\(\s*['\"]{2}\s*\)|Array\.from\(|\[\.\.\.\w+\]|Segmenter\([^)]*grapheme", src)
- boxes = re.search(r"inline-block|inlineBlock|display:\s*['\"]?flex|display:\s*['\"]?grid", src)
- if splits and boxes:
- add(src[: splits.start()].count("\n") + 1, "letter-boxes",
- "text split into characters in a file that also makes inline-block/flex boxes: per-letter boxes break Persian joins (use shaped outlines or split_fa.js)")
- if not re.search(r"rtl", src) and re.search(f"['\"`>][^'\"`<]*[{FA_LETTER}]", code_only):
- add(1, "no-rtl", 'Persian text but no dir="rtl" anywhere in this file')
- return issues
- def walk(paths):
- for p in paths:
- if os.path.isdir(p):
- for root, dirs, files in os.walk(p):
- dirs[:] = [d for d in dirs if d not in ("node_modules", ".git", "out", "dist", "build")]
- for f in files:
- if f.endswith(CODE_EXT):
- yield os.path.join(root, f)
- else:
- yield p
- def main(argv):
- if len(argv) < 3 or argv[1] not in ("copy", "code"):
- print(__doc__)
- return 2
- mode, targets = argv[1], argv[2:]
- issues = []
- if mode == "copy":
- for t in targets:
- if os.path.exists(t):
- issues += lint_copy_text(open(t, encoding="utf-8").read(), t)
- else:
- issues += lint_copy_text(t, "<text>")
- else:
- for f in walk(targets):
- issues += lint_code_file(f)
- for name, ln, col, code, msg in issues:
- print(f"{name}:{ln}:{col} {code} {msg}")
- print(f"\n{len(issues)} issue(s)" if issues else "clean")
- return 1 if issues else 0
- if __name__ == "__main__":
- sys.exit(main(sys.argv))
scripts/split_fa.js · Bundled script · 61 lines
- /*
- * splitFa: split a Persian word into letters that keep their joined forms.
- *
- * Per-letter animation needs each letter in its own box, and a box is shaped on its
- * own, so letters fall back to their isolated forms. A zero-width joiner (U+200D) on
- * each side that joins a neighbour makes every box take its joined form again.
- *
- * import { splitFa } from './split_fa.js';
- * splitFa('میشود') // ['م', 'ی', 'ش', 'و', 'د']
- *
- * Keeps لا together (a required ligature), keeps vowel marks and the half-space (ZWNJ)
- * on their letter. Limits: kerning between boxes is lost (words grow a few px at display
- * sizes) and Nastaliq loses its diagonal cascade, so animate Nastaliq by word or line.
- * For full control (dots, kashida, exact positions) use shape_persian.py outlines.
- *
- * Run `node split_fa.js --test` to print sample splits.
- */
- const ZWJ = '';
- const ZWNJ = '';
- const ARABIC_LETTER = /[ؠ-يٮ-ۓۺ-ۿ]/;
- const RIGHT_JOINING = /[آ-إاةد-زوژۀ]/; // آأؤإاةدذرزوژۀ
- const MARK = /[ً-ٰٟ]/;
- const ALEFS = /[آأإا]/;
- const base = (s) => s.replace(/[ً-ٰٟ]/g, '');
- const joinsForward = (s) => {
- const c = base(s).slice(-1);
- return !s.endsWith(ZWNJ) && ARABIC_LETTER.test(c) && !RIGHT_JOINING.test(c) && c !== 'ء';
- };
- const joinsBackward = (s) => {
- const c = base(s)[0];
- return ARABIC_LETTER.test(c) && c !== 'ء';
- };
- export function splitFa(word) {
- const parts = [];
- for (const ch of word) {
- const last = parts.length - 1;
- if (last >= 0 && (MARK.test(ch) || ch === ZWNJ)) parts[last] += ch; // marks and ZWNJ stay on their letter
- else if (last >= 0 && ALEFS.test(ch) && /ل[ً-ٰٟ]*$/.test(parts[last])) parts[last] += ch; // keep لا together
- else parts.push(ch);
- }
- return parts.map((p, i) => {
- const before = i > 0 && joinsForward(parts[i - 1]) && joinsBackward(p) ? ZWJ : '';
- const after = i < parts.length - 1 && joinsForward(p) && joinsBackward(parts[i + 1]) ? ZWJ : '';
- return before + p + after;
- });
- }
- /* Split a whole line: words stay separate units (split them with splitFa only when needed). */
- export function splitWords(line) {
- const seg = new Intl.Segmenter('fa', {granularity: 'word'});
- return [...seg.segment(line)].map((s) => s.segment);
- }
- if (typeof process !== 'undefined' && process.argv && process.argv.includes('--test')) {
- const show = (s) => s.replace(//g, '⁺').replace(//g, '‿');
- for (const w of ['میشود', 'کتابها', 'مژده', 'لاله', 'ژرفِ', 'سؤال', 'آیندهای', 'کارگردان', 'بالا']) {
- console.log(w.padEnd(10), splitFa(w).map(show).join(' | '));
- }
- }
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.