Skip to content
Back to skills

P5

ASecurity

Learn how to use P5.js with Helios. Use when creating creative coding sketches or generative art.

  • 124 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 5, 2026
ai-agentstypescriptreactaws

Security analysis

A100/100

Scanned November 5, 2026

npx -y skills add BintzGavin/helios --skill p5 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of P5?

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

Security grade badge for P5
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/bintzgavin-helios-helios/badge)](https://www.skillsdirectory.com/skills/bintzgavin-helios-helios)

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: example-p5-animation
description: Learn how to use P5.js with Helios. Use when creating creative coding sketches or generative art.
---

# P5.js Animation

Integrate P5.js with Helios by using P5's **Instance Mode** and driving the `draw()` loop via Helios's state.

## Quick Start

```typescript
import { Helios } from '@helios-project/core';
import p5 from 'p5';

const helios = new Helios({ duration: 10, fps: 60 });
window.helios = helios; // lets the renderer and player drive it

const sketch = (p: p5) => {
  p.setup = () => {
    p.createCanvas(1920, 1080);
    p.noLoop(); // Disable P5's internal loop
  };

  p.draw = () => {
    // Get time from Helios
    const { currentFrame, fps } = helios.getState();
    const time = currentFrame / fps;

    p.background(200);
    p.fill(255, 0, 0);

    // Animate based on time
    const x = time * 100;
    p.circle(x, 540, 50);
  };
};

const instance = new p5(sketch, document.getElementById('canvas-container'));

// Drive P5 from Helios: redraw on every frame change.
helios.subscribe(() => instance.redraw());
```

## Key Patterns

### Instance Mode
Always use Instance Mode (`new p5(sketch)`) instead of Global Mode. This prevents global variable pollution and ensures compatibility with module bundlers.

### Disable Internal Loop
Call `p.noLoop()` in `setup()`. P5's internal loop uses `requestAnimationFrame` which runs independently of Helios. By disabling it, you ensure P5 only draws when Helios updates.

### Reactive Drawing
Instead of relying on P5's `frameCount`, calculate positions based on `helios.getState().currentFrame`.

```typescript
helios.subscribe(() => {
   // Assuming 'myp5' is your instance
   myp5.redraw();
});
```

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.

Comments

Loading comments…

Newsletter

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