BintzGavin/helios / skills/examples/signals
example-signals-animation
VerifiedLearn how to use Helios Signals for high-performance, fine-grained reactivity. Use for complex dependency graphs or when optimizing performance.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 1.6 KB |
SKILL.md
View on GitHub---
name: example-signals-animation
description: Learn how to use Helios Signals for high-performance, fine-grained reactivity. Use for complex dependency graphs or when optimizing performance.
---
# Signals Animation
Helios exposes a Signal-based reactivity system (similar to SolidJS or Preact Signals) for managing state efficiently.
## Quick Start
```typescript
import { Helios, computed, effect } from '@helios-project/core';
const helios = new Helios({ duration: 10, fps: 60 });
// Access signals directly
const frame = helios.currentFrame; // ReadonlySignal<number>
// Create computed values
const rotation = computed(() => {
return (frame.value / 60) * 360; // Rotate 360 deg per second
});
// React to changes
effect(() => {
const div = document.getElementById('box');
div.style.transform = `rotate(${rotation.value}deg)`;
});
```
## Key Patterns
### Derived State
Use `computed()` to create state that depends on other signals. It only re-evaluates when dependencies change.
```typescript
const progress = computed(() => helios.currentFrame.value / (helios.duration * helios.fps));
const width = computed(() => progress.value * 100 + '%');
```
### Side Effects
Use `effect()` to perform DOM updates or rendering logic. Effects run immediately and re-run whenever any signal accessed inside them changes.
### Performance
Signals are more efficient than `helios.subscribe()` for complex graphs because they update fine-grained dependencies rather than the entire state tree.
## Source
- Example: `examples/signals-animation/`
- API: `packages/core/src/signals.ts`
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |