Skip to content

Instantly share code, notes, and snippets.

function setup() {
createCanvas(400, 300);
background(0,0,0);
noStroke();
}
function draw() {
fill(204,204,204);
triangle(12, 12, 12, 200, 81, 200);
//Get a remote json and assign it to the var json
var json = get('https://api.coindesk.com/v1/bpi/historical/close.json?start=2017-06-01&end=2017-12-06')
function setup() {
createCanvas(188, 188)
}
function draw() {
//Remove Borders
noStroke();
var palette = ["#BFBFBF","#A1A1A1","#696969","#242A38","#141926"]
function setup() {
createCanvas(400, 300);
}
function draw() {
noStroke();
var size = height/6
for(y=0;y<height;y=y+size){
var xspacing = 16;
var w;
var theta = 0.0;
var amplitude = 75.0;
var period = 500.0;
var dx;
var yvalues;
function setup() {
createCanvas(400, 300);
@jacopocolo
jacopocolo / 3bodycovers.js
Created March 19, 2018 08:53
A tiny p5js script to generate random ellipses
function setup() {
createCanvas(400, 400);
}
function draw() {
if (random()>0.5) {
background("#004047"); //night
} else {
background("#D6F4F6"); //day
}
@jacopocolo
jacopocolo / Basic-sketchplugin-test.js
Created April 13, 2018 02:04
This script draws a simple point without fills or strokes in the first canvas. Works with Sketch 49
var ctx, doc, selection, page, view, artboards;
function exposeContext(context) {
ctx = context;
doc = context.document;
selection = context.selection;
page = [doc currentPage];
view = [doc contentDrawView];
artboards = [[doc currentPage] artboards];
}
javascript: void
function(e) {
var a = function(e) {
e("._1n6QCWhOqlnrzKvA4Q6dbB").css({
top: "0px",
left: "40px",
display: "flex",
flexDirection: "column"
}), e(".g525kr71XL4ps4xKw4IBu").css({
//var palette = ["rgb(239,175,166)", "rgb(148,201,251)", 'rgb(241,87,116);)', 'rgb(181, 33, 25)', 'rgb(255,206,7)'];
var cWidth = 500; //canvas width
var cHeight = 500; // canvas height
var x;
function setup() {
createCanvas(cWidth, cHeight);
x = 0;
noLoop();
}
function setup() {
createCanvas(200, 200) //set up a 200x200 px artboard
background("#FFFFFF")
}
function draw() {
symbol('rect',0,0);
fill("#f0a90f")
stroke("#98678f")
rect(0,0,width/4,height/4)
function setup() {
createCanvas(200,200);
background(0);
}
function draw() {
ellipse(0,0,100,100);
}