Giter VIP home page Giter VIP logo

creative-coding's Introduction

Creative Coding Session

Beispiel Repository

Im folgenden Beispiel Repository finden sich zu jedem Gerät ausführliche Codebeispiele, die als Referenz (und natürlich zum herum spielen) heran gezogen werden können. https://github.com/methodpark/creative-coding

Wenn ihr Lust habt könnt ihr mit eurem Projekt einen Pull Request stellen, dann haben wir im Anschluss eine kleine Sammlung spannender Beiträge die wir im Anschluss vorstellen können!

Systemvoraussetzungen

  • node.js (z.B. version 10, download unter https://nodejs.org/en/download/), ab node v12 gibt es momentan scheinbar Probleme
  • eine Buildumgebung (z.B. MSVS, abhängig von eurem Betriebssystem)
  • Python 2.7

Eine Detailanleitung zur Installation findet ihr unter: https://github.com/nodejs/node-gyp

Natürlich könnt ihr auch jede andere Programmierumgebung nutzen! Dieses Cheatsheet bezieht sich allerdings nur auf Node.js / JavaScript.

Installation

git clone [email protected]:methodpark/creative-coding.git

cd creative-coding

npm install

Launchpad

Initialisierung

const lunchpad = require('lunchpad');
const Color = lunchpad.Color;

lunchpad.initialize().then(launchpad => {
  // your code here
});

Get + Set

getSquare(x, y): fragt die Farbe eines Feldes ab
setSqare(x, y, color): setzt die Farbe eiens Feldes
getFunctionX(x): fragt die Farbe eines horizontalen Funktionsbuttons ab
setFunctionX(x, y, color): setzt die Farbe eines horizontalen Funktionsbuttons
getFunctionY(x, y): fragt die Farbe eines vertikalen Funktionsbuttons ab
setFunctionY(x, y, color): setzt die Farbe eines horizontalen Funktionsbuttons
clearSquares(): setzt alle Felder zurück
clearAll(): setzt alle Buttons zurück

Events

launchpad.on('input', (x, y) => ...)
Button Event mit den Koordinaten des Buttons

launchpad.on('functionX', x => ...)
Button Event für die horizontalen Funktions Buttons

launchpad.on('functionY', y => ...)
Button Event für die vertikalen Funktions Buttons

Farben

Launchpad unterstützt drei Farben: Color.RED, Color.Amber und Color.Green

Für jeder Farbe existieren drei Helligkeitsstufen:

const myRed = Color.RED;
const lighterRed = myRed.lighter();

DMX

const Fixture = require('./lib/Fixture');
const getUniverse = require('./lib/getUniverse');

// erzeugt ein universe für das usbPro interface
getUniverse('usbPro').then(universe => {
  const fixture = new Fixture(1, universe);

  fixture.brightness(1);
  fixture.color('fuchsia');
});

Alternativ kann auch der Debug Treiber verwendet werden:

getUniverse('debug').then(universe => {
  // ...
});

Fixture

Die Fixture Klasse abstrahiert das Setzen von Farbwerten und der Helligkeit eines Lichtelementes.

const fixture = new Fixture(basePort, universe);

fixture.brightness(1);    // ein Wert zwischen 0 und 1
fixture.color('fuchsia'); // ein benannter Farbwert oder Hexvalue (#f00)

creative-coding's People

Contributors

makmic avatar migerh avatar schinken avatar seriousmanual avatar yogan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.