npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@codaloop/runtime

v0.1.3

Published

A simplified game programming API for kids — Canvas drawing, sprites, sound, and a 60fps game loop. Think Processing/p5.js but simpler.

Readme

@codaloop/runtime

A simplified game programming API for kids — Canvas drawing, sprites, sound, and a 60fps game loop. Think Processing/p5.js but simpler.

Built for Codaloop, a zero-friction browser-based game programming environment for classrooms.

Install

# npm
npm install @codaloop/runtime

# Deno / JSR
deno add jsr:@codaloop/runtime

Quick Start

import { createRuntime } from "@codaloop/runtime";

const runtime = createRuntime();

// Game loop
runtime.start({
  setup() {
    size(400, 400);
  },
  draw() {
    background("skyblue");
    fill("yellow");
    circle(mouseX, mouseY, 30);
  },
  keyPressed() {
    if (key === " ") playSound("jump");
  },
});

Browser (IIFE)

The browser bundle reads user code from a __CODALOOP_CODE__ global, which is useful for sandboxed iframe environments:

<script src="codaloop.js"></script>
<script>
  window.__CODALOOP_CODE__ = `
    function setup() { size(400, 400); }

    function draw() {
      background("white");
      fill("red");
      circle(mouseX, mouseY, 30);
    }
  `;
</script>

API Overview

Lifecycle

  • size(w, h) — Set canvas size
  • background(color) — Clear canvas with a color
  • noLoop() / loop() — Stop/restart the draw loop

Shapes

  • rect(x, y, w, h) — Rectangle
  • circle(x, y, r) — Circle
  • ellipse(x, y, w, h) — Ellipse
  • line(x1, y1, x2, y2) — Line
  • triangle(x1, y1, x2, y2, x3, y3) — Triangle
  • arc(x, y, r, startAngle, stopAngle) — Arc (degrees)
  • text(str, x, y) — Text

Style

  • fill(color) / noFill() — Fill color
  • stroke(color) / noStroke() — Outline color
  • strokeWeight(n) — Outline thickness
  • textSize(n) / textAlign(align) — Text styling
  • color(r, g, b, a?) — Create RGBA color
  • push() / pop() — Save/restore drawing state + transforms
  • translate(x, y) / rotate(angle) — Transform (degrees)

Input

  • mouseX, mouseY — Mouse position
  • mouseIsPressed — Is mouse down?
  • key, keyIsPressed — Last key pressed
  • keyIsDown(k) — Is a specific key held?
  • keyPressed() / keyReleased() — Callbacks (define as globals)

Sprites

  • createSprite(x, y, w, h) — Create a sprite
  • drawSprite(s) / moveSprite(s) — Draw/move
  • collides(a, b) — AABB collision between two sprites
  • overlap(s, x, y) — Check if a point is inside a sprite
  • applyGravity(s, amount?) / bounceEdges(s) — Physics helpers

Pixel Art

  • createImage(rows, colorMap) — Create from string art (. or space = transparent)
  • drawImage(img, x, y, scale?) — Draw pixel image
  • getImage(name, colors?) — Get built-in sprite
const ship = createImage(
  [
    "..R..",
    ".RRR.",
    "RRRRR",
  ],
  { R: "red" }
);
drawImage(ship, 100, 100, 3);

Sound

  • playSound(name)"beep", "coin", "jump", "hit", "explosion", "powerup", "laser", "pop"
  • playNote(note, duration, volume?) — Play a musical note ("C4", "F#5", etc.)
  • playDrum(name)"kick", "snare", "hihat"

Math

  • random(max) / random(min, max) — Random float
  • randomInt(max) / randomInt(min, max) — Random integer
  • dist(x1, y1, x2, y2) — Distance
  • constrain(val, lo, hi) — Clamp
  • map(val, fromLo, fromHi, toLo, toHi) — Remap
  • lerp(a, b, t) — Linear interpolation

Developer Tools

  • gridHelper(opts?) — Overlay a coordinate grid with a pinnable crosshair

Building

deno task build       # IIFE browser bundle → codaloop.js
deno task build:npm   # npm package → npm/
deno task publish:jsr # publish to JSR

License

MIT