MCPcopy
hub / github.com/soulwire/sketch.js

github.com/soulwire/sketch.js @v1.1 sqlite

repository ↗ · DeepWiki ↗ · release v1.1 ↗
74 symbols 155 edges 5 files 0 documented · 0%
README

sketch.js

A tiny (~2kb gzipped) platform for JavaScript creative coding.

A few examples from the showcase

Start Coding Faster

sketch.js lets you get straight to the fun parts of creative coding, without ever having to worry about shims or boilerplate code.

It gives you a graphics context, an animation loop, normalised input events and a host of useful callbacks to hook into.

Here's an example:

Sketch.create({
    setup: function() {
        this.r = this.g = this.b = random( 100, 200 );
    },
    mousemove: function() {
        this.r = 255 * ( this.mouse.x / this.width );
        this.g = 255 * ( this.mouse.y / this.height );
        this.b = 255 * abs( cos( PI * this.mouse.y / this.width ) );
    },
    draw: function() {
        this.fillStyle = 'rgb(' + ~~this.r + ',' + ~~this.g + ',' + ~~this.b + ')';
        this.fillRect( 0, 0, this.width, this.height );
    }
});

See it in action

The Highlights

  • A sketch is an augmented drawing context (CanvasRenderingContext2D, WebGLRenderingContext or HTMLElement) so it has all the expected drawing methods built in.
  • The mouse property is also the first element of the touches array and vice versa, so you can code to one standard and get touch and multi-touch support for free.
  • The update and draw loops run on the browser animation frame and can stop and start whenever you like.
  • You get fast access to Math functions and constants, plus extras like range and array enabled random, map and lerp.
  • Simple and configurable. You can even bring your own context, so it works well with libraries like THREE.

The Rest

For more information, check out the getting started guide, the API, the many examples in the showcase and the full source.

Core symbols most depended-on inside this repo

expect
called by 140
tests/jasmine/jasmine.js
runs
called by 17
tests/jasmine/jasmine.js
simulate
called by 14
tests/spec/sketch.js
trigger
called by 9
js/sketch.js
waitsFor
called by 9
tests/jasmine/jasmine.js
onComplete
called by 8
tests/jasmine/jasmine.js
isUndefined
called by 8
tests/jasmine/jasmine-html.js
specPluralizedFor
called by 7
tests/jasmine/jasmine-html.js

Shape

Function 74

Languages

TypeScript100%

Modules by API surface

js/sketch.js24 symbols
js/sketch.min.js21 symbols
tests/jasmine/jasmine.js18 symbols
tests/jasmine/jasmine-html.js9 symbols
tests/spec/sketch.js2 symbols

For agents

$ claude mcp add sketch.js \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact