knit-tink

A prototype interface for working live with algorithmic knitting patterns, via the AYAB (all yarns are beautiful) hardware hack of Brother knitting machines.

Return to knit-tink

Minimal instructions

A pattern is defined as a simple javascript function in one of two forms; either row(row) to calculate a row at a time from a given row number, or needle(needle, row) to calculate a needle postiion at a time based on needle number and row number. For example:

const needle = (needle, row) => (needle ^ row) % 3;

Or to define a function for calculating a row at a time, you could do:

function row(row) {
  const result = [];
  for (let i = 0; i < 200; ++i) {
    result.push(Math.round(Math.random()));
  }
  return(result);
}
Open in knit-tink

Which would be the same as doing:

function needle(needle, row) {
  return Math.round(Math.random())
}
    
Open in knit-tink

Both row and needle functions also accept a third 'history' argument that is a function for reading previous rows. E.g. history(1, needle) repeats the previous row, and history(1, needle+1) shifts it one needle. So the following will take the previous row, and progressively shift it to the left.

function needle(needle, row, history) {
  if (row == 0) {
    // If it's the first row, select every 5th needle
    return needle % 5 == 0
  }
  // Otherwise shift the needle by one
  return history(1, needle+1);
}
    
Open in knit-tink

... and the following example will use history to create a simple cellular automata.

function needle(needle, row, history) {
  if (row == 0) {
    // seed first row
    return needle == 0;
  }
  else {
    const state = '' + history(1, needle-1) + history(1, needle) + history(1, needle+1);
    // rule 110 https://en.wikipedia.org/wiki/Rule_110
    return ['110', '101', '011', '010', '001'].includes(state);
  }
}
    
Open in knit-tink

knit-tink supports collaborative patterning, just share the URL with a friend. Edits to the code and 'update' evaluations are shared. Other interactions, like progressing to the next row by knitting or pressing 'simulate', are not.

Privacy

The webcam feature runs locally in your browser, no images are shared or stored online.

The room name is stored in the URL. If you want to share your code but not your room name (or vice-verse), please edit the URL before sharing.

When you join a room, your code edits will be stored online, in order to enable collaboration. This is temporary storage and may be deleted at any time.

Free/open source software

(c) Alex McLean and contributors 2026, released under the Affero GNU Public License, v3.0 or later.

source

References

Lin, Pei-Ying, Kristina Andersen, Ralf Schmidt, et al. 2024. ‘Informed by Yarns - Proposing Knitting Patterns for Revealing Digital System Activities’. Proceedings of the 13th Nordic Conference on Human-Computer Interaction (New York, NY, USA), NordiCHI ’24, October 13, 1–16. https://doi.org/10.1145/3679318.3685338.