Skip to content

Instantly share code, notes, and snippets.

View catarak's full-sized avatar
🌈
it's a unix system, i know this

Cassie Tarakajian catarak

🌈
it's a unix system, i know this
View GitHub Profile
var seneca = require('seneca')();
// seneca.use('./todo.js');
seneca.client({ type: 'tcp', pin: 'role:todo' });
seneca.act({role:'todo', cmd:'add', name:'Buy Milk'}, function(err, todo) {
console.log(todo);
}
var seneca = require('seneca')();
seneca.use('./todo.js');
seneca.listen({ type: 'tcp', pin: 'role:todo' }); // default port is 10101
var seneca = require('seneca')();
seneca.use('./todo.js');
seneca.act({role:'todo', cmd:'create', name:'Buy Milk'}, function(err, todo) {
console.log(todo);
}
module.exports = function(options) {
var seneca = this;
seneca.add({role:'todo', cmd:'create', createTodo);
function createTodo(args, done) {
var todoText = args.text;
// ... perform todo creation
done(null, todo);
}
}
var video;
var x = 0;
function setup() {
createCanvas(800, 240);
pixelDensity(1);
video = createCapture(VIDEO);
video.size(320, 240);
var capture;
var stepSize = 5;
function setup() {
createCanvas(400, 300);
capture = createCapture(VIDEO);
capture.size(400, 300);
capture.hide();
rectMode(CENTER);
noStroke();
function setup() {
createCanvas(400, 400);
noStroke();
background(220);
}
function draw() {
var xColor = map(mouseX, 0, width, 0, 255);
var yColor = map(mouseY, 0, height, 0, 255);
fill(xColor, yColor, 200);
// ONE
function Agent() {
this.position = createVector(random(width), random(height));
}
Agent.prototype.update = function() {
ellipse(this.position.x, this.position.y, 50, 50);
}
Set expectations - This workshop is going to teach you the basics of JavaScript though creative coding.
What is p5.js? It is a library of JavaScript to draw, making static, animated, interactive or generative visuals. You can include sounds, images, text, you can interact with HTML, you can make graphs, you can interact with sensors, you can use physics. You can do lots and lots of things. You can use other libraries. It is awesome.
It is an open source library, which means that all of its code is free and available to anyone. It was created by Lauren McCarthy and is supported by the Processing Foundation.
http://www.leslieruckman.com/ITP2016/100DaysOfMaking/Day47/
http://www.leslieruckman.com/ITP2016/100DaysOfMaking/Day72/
http://www.leslieruckman.com/ITP2016/100DaysOfMaking/Day32/
http://www.leslieruckman.com/ITP2016/100DaysOfMaking/Day9/
http://xie-emily.com/generative_art/noise_art.html

Day 1

Start with Cassie

  • Ahead of time - download p5.js desktop editor
  • Set expectations - learn to code through making interactive and generative art
  • What is p5.js? What does the .js mean? Show some examples interactive, generative art. (http://leslieruckman.tumblr.com/)
  • What is code? Briefly mention that code is a series of instructions, executed sequentially.
  • Stay within setup(). Talk about how to draw simple shapes, coordinate system, stroke, fill, background
    • exercise - draw three shapes, snowman
  • Talk about draw(). Discuss frames, 30 f/s minimum, etc. Throw in the word loop.
  • code inside is getting executed over and over again, but at a fixed rate, every 1/60th of a second