Skip to content
Back to skills

Move And Time

ASecurity

Use the engine's frame clock to move things smoothly, repeat actions on a schedule, and ease motion.

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 7, 2026
developmentgospring

Security analysis

A100/100

Scanned November 24, 2026

npx -y skills add blit386/blit386 --skill move-and-time --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Move And Time?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Move And Time
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/blit386-move-and-time/badge)](https://www.skillsdirectory.com/skills/blit386-move-and-time)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: move-and-time
description:
  Move things smoothly and schedule actions using the engine frame clock, the Timer helper, and the easing curve library
  (`applyEasing`, `interpolate`). Use for movement, timers, cooldowns, spawn intervals, animation frames, tweening a
  position or color between two values, or anything that should happen 'every N frames' or 'over N seconds'.
---

# Move and time things

Use the engine's frame clock to move things smoothly, repeat actions on a schedule, and ease motion.

## Read-only clock (properties, no parentheses)

```js
update() {
    // BT.ticks: whole number of update steps since start. Schedule with modulo:
    if (BT.ticks % 30 === 0) {
        this.spawnEnemy(); // twice a second at 60 FPS
    }

    // BT.deltaSeconds: seconds per step. Use for speed-per-second motion:
    this.x += this.speedPerSecond * BT.deltaSeconds;
}
```

- `BT.ticks`, `BT.timeSeconds`, `BT.deltaSeconds`, `BT.targetFPS` - all getters.
- `BT.ticksReset()` (method) - zero the tick counter, e.g. on restart.
- Motion that looks stepped or jittery on a fast monitor needs drawing between updates: see `smooth-the-motion`.

## Timer helper

```js
import { Timer } from 'blit386';

// in init():
this.fireTimer = new Timer(20); // fires every 20 ticks

// in update():
if (this.fireTimer.fireIfElapsed(BT.ticks)) {
  this.fire();
}
```

## Easing for smooth motion

Easing bends a straight 0..1 progress value into something that accelerates, overshoots, or bounces.

```js
import { applyEasing } from 'blit386';

const t = (BT.ticks % 60) / 60; // 0..1
const eased = applyEasing(t, 'ease-in-out');
this.y = Math.floor(100 + eased * 50); // round before drawing
```

### Which curve

Every family below comes in three versions: `-in` (slow start), `-out` (slow finish), and `-in-out` (both). So
`'sine-in'`, `'sine-out'`, and `'sine-in-out'` all exist, and the same for the rest.

| Name | Feels like |
| --- | --- |
| `'linear'` | No easing - constant speed |
| `'ease-in'` / `'ease-out'` / `'ease-in-out'` | The gentle default (quadratic) |
| `'sine-*'` | Very soft, barely noticeable |
| `'cubic-*'`, `'quartic-*'`, `'quintic-*'` | Progressively sharper acceleration |
| `'expo-*'` | Extreme - near-still, then a rush |
| `'circ-*'` | Slow, then a sudden hard pull |
| `'back-*'` | Overshoots slightly and settles - good for menus popping in |
| `'elastic-*'` | Springs past the target and wobbles |
| `'bounce-*'` | Bounces like a dropped ball |

`'back-*'` and `'elastic-*'` deliberately leave the 0..1 range mid-animation, so leave room around whatever you are
moving.

### Interpolating between two values

`interpolate` applies a curve and blends two values in one call, so you do not do the arithmetic yourself. It works on
plain numbers and on `Vector2i`, `Color32`, and `Rect2i`, rounding integer types for you:

```js
import { interpolate, Vector2i } from 'blit386';

const t = (BT.ticks % 90) / 89; // 0..1, reaching 1 on the last frame of the cycle
this.pos = interpolate('bounce-out', new Vector2i(20, 20), new Vector2i(200, 180), t);
```

Watch the argument order - it is the reverse of `applyEasing`: `interpolate(easing, start, end, t)` but
`applyEasing(t, easing)`.

## Notes

- Do timing in `update()`, not `render()`.
- Round to whole numbers before drawing (`Math.floor`) - rendering is integer-only.
- `Timer.fireIfElapsed()` advances its own state, so call it once per frame.

See `docs/basics.md`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.