Skip to content

Instantly share code, notes, and snippets.

#include <Adafruit_DotStar.h>
// There is only one pixel on the board
#define NUMPIXELS 1
//Use these pin definitions for the ItsyBitsy M4
#define DATAPIN 7
#define CLOCKPIN 8
Adafruit_DotStar strip(NUMPIXELS, DATAPIN, CLOCKPIN, DOTSTAR_BRG);
@zamfi
zamfi / tracking.js
Last active February 7, 2022 15:31
// following tracks
var track = [];
function setup() {
createCanvas(340, 340);
for (var x = width / 4; x < 3*width/4; x += 10) {
track.push({
x: x,
y: height/4
// "spaced colored squares" -- object edition
var squares = [];
function setup() {
colorMode(HSB);
noFill();
for (var x = 50; x <= 250; x = x + 50) {
squares.push({
// "spaced colored squares" -- array edition
colorMode(HSB);
noFill();
var SIZE = 40;
var y = height/2 - SIZE/2;
var squares = [
{ x: 50, y: y },
// "spaced colored squares" -- array edition
colorMode(HSB);
noFill();
var SIZE = 40;
var xs = [50, 100, 150, 200, 250];
var y = height/2 - SIZE/2;
// "spaced colored squares" -- object edition
colorMode(HSB);
noFill();
var SIZE = 40;
var squares = [];
for (var x = 50; x <= 250; x = x + 50) {
function happyFace(x, y) {
// head
ellipse(x, y, 100, 100);
// eyes
ellipse(x-20, y-25, 20, 20);
ellipse(x+20, y-25, 20, 20);
// nose
line(x, y-20, x-10, y);
for (var x = 10; x < width; x += 20) {
if (x < width/2) {
line(x, 10, x, height/2);
} else {
line(x, height-10, x, height/2);
}
}
for (var x = 10; x < width; x += 20) {
line(x, 10, x, height-10);
}
rect(70, 70, 200, 200);
rect(width/2 - 100, height/2 - 100, 200, 200);
var offset = 100;
rect(width/2 - offset, height/2 - offset, offset*2, offset*2);
offset = 90;
rect(width/2 - offset, height/2 - offset, offset*2, offset*2);