Przejdź do treści
Biblioteka skilli
Programowanie · Przegląd i audyt

enforce-rules-for-render-loops

/enforce-rules-for-render-loops

Pilnuje reguł czasu w pętlach renderowania w AIRI: przegląda kod ruchu, reakcji i efektów z próbkowaniem klatek w Pixi, TresJS i Three.

Repozytorium
airi ↗
Licencja
MIT
Ostatnia zmiana repozytorium
13.11.2026

Ocena i bezpieczeństwo

100/ 100Klasa: dobry
Format25 / 25
Frontmatter z nazwą i opisem, poprawna nazwa, opis do 1024 znaków, nazwa zgodna z folderem.
Odkrywalność25 / 25
Opis mówi, kiedy użyć skilla, ma sensowną długość i jest w 3. osobie.
Treść35 / 35
Co najmniej 150 słów i do 500 linii, nagłówki, listy kroków, przykłady albo kod.
Higiena15 / 15
Bez zaślepek typu TODO, bez ścieżek Windows, z licencją.
Ryzykobrak sygnałów w skanie
Pliki w paczce
1
Skrypty
0
Komentarze HTML
0
Adresy URL w SKILL.md
0
Przestarzałość

Brak sygnałów. Repozytorium zmienione 13.11.2026, bez odwołań do wycofanych modeli i API.

Licencja

MIT, otwarta: można używać i zmieniać, z zachowaniem informacji o autorze.

Co robi i kiedy

Pilnuje reguł czasu w pętlach renderowania w AIRI: przegląda kod ruchu, reakcji i efektów z próbkowaniem klatek w Pixi, TresJS i Three.

Oryginalny opis (EN)

Enforce AIRI's rules for time in render loops. Use when you write or review motion, reaction, animation, spring, or effect code that a Pixi (Live2D), TresJS (VRM), or Three (MMD) frame loop samples, or when an event outside the loop starts an effect that a frame then plays.

Jak działa

  1. Find the clock
  2. Rules
  3. Tests
Sekcje z nagłówków SKILL.md, w oryginale · 34 linii, 394 słów
Podgląd SKILL.md
---
name: enforce-rules-for-render-loops
description: Enforce AIRI's rules for time in render loops. Use when you write or review motion, reaction, animation, spring, or effect code that a Pixi (Live2D), TresJS (VRM), or Three (MMD) frame loop samples, or when an event outside the loop starts an effect that a frame then plays.
---

# Enforce Rules for Render Loops

A render loop has its own clock. Code that a frame samples must read time from that clock only.

## Find the clock

| Renderer | Clock | Unit |
| --- | --- | --- |
| Live2D (`stage-ui-live2d`) | `ctx.now` of a motion manager plugin. It comes from `Live2DModel.elapsedTime`. `Model.vue` keeps the time of the last frame in `lastUpdateTime`. | Seconds. `Cubism4InternalModel.update` runs `now /= 1e3` before `motionManager.update`. |
| VRM (`stage-ui-three`) | `onBeforeRender(({ delta, elapsed }) => ...)` of TresJS `useLoop()` | Seconds |
| MMD (`stage-ui-mmd`) | The `Clock` of the scene, `clock.getDelta()` | Seconds |

## Rules

- Do not mix the frame clock with `performance.now()` or `Date.now()` in values that a frame samples.
  - A frame clock adds the time of each frame, and it falls behind the wall clock:
    - The Pixi ticker counts at most 100 ms for one frame (`Ticker._maxElapsedMS`).
    - A hidden tab pauses `requestAnimationFrame`.
    - A paused stage stops the ticker.
  - The difference grows during a session. It can be several seconds.
- An event from outside the loop, for example a pointer event, a store change, or a speech bus event, starts its effect at the frame time of the last frame. Alternatively, it queues the effect for the next frame.
  - Do not give it a `performance.now()` timestamp.
  - Example: `Model.react()` triggers the touch reaction at `lastUpdateTime`, the clock of `useMotionUpdatePluginTouchReaction`.
- Use `performance.now()` only to measure durations for traces and logs, never as animation input.
- Name the unit in each time name: `atMs`, `elapsedSeconds`, `durationMs`. Convert once, at the boundary.
- Bound the delta in springs and integrators. A delta can be 0 on the first frame and large after a stall. See `createLive2DMotionSpring`, which splits a step into substeps and clamps the total.

## Tests

- Write time-based logic as functions of explicit time inputs, for example `sample(nowSeconds)`, and test them with chosen times.
- A test for an effect that one clock starts and another clock samples must use both clocks as the runtime does. A test that triggers and samples with the same clock cannot find a clock mismatch.
- For runtime checks, sample the value that the frame renders, on the frame clock, for example `touchReaction.sample(lastUpdateTime)`. Also report the difference between the frame clock and the wall clock.

Wersje

W bazie nie ma innych skilli o nazwie enforce-rules-for-render-loops.

Migawka bazy z 13.11.2026 · wersja paczki 5532d99ed15c (skrót SHA-256 całej paczki)

Pobrania w ostatnich 30 dniach: 0 · ranking

Zgłoś problem z tym skillem: szkodliwa treść, błędny opis albo prośba autora o usunięcie.

Podobne skille

  • 100enforce-rules-for-typescript
    Wymusza zasady kodu TypeScript i Vue projektu AIRI: importy, nazewnictwo, komentarze, JSDoc, fallbacki i projekt modułów przy pisaniu i przeglądzie kodu.
  • 100use-vishot-for-airi
    Uruchamia scenariusze Vishot dla AIRI w przeglądarce i Electron, z pominięciem onboardingu i importem lokalnego modelu Live2D, VRM lub MMD.
  • 100tresjs-core-skilld
    Pomaga pisać deklaratywną grafikę 3D w Three.js przez komponenty Vue, w tym TresCanvas, pętle i pointer events.
  • 100init-pixi-project
    Inicjalizuje nowy projekt Pythona zarządzany przez Pixi albo aktualizuje istniejący, pytając o potwierdzenie przed scaleniem.
  • 100rpix
    Zarządza pakietami R w projekcie Pixi: instaluje je, zapisuje w pixi.toml i pixi.lock, uruchamia skrypty i testy zamiast install.packages czy renv.

Uwagi i zgłoszenia

Wiadomość trafi do Bartosza Sokolińskiego. Adres e-mail jest potrzebny tylko do odpowiedzi. Szczegóły w polityce prywatności.