Skip to content

Instantly share code, notes, and snippets.

@yat1ma30
yat1ma30 / main.js
Last active December 23, 2015 03:39
ラングトンのアリ
var SCREEN_SIZE = 500; // キャンバスのサイズ
var SIDE_CELLS = 200; // 一辺のセルの数
var CELL_SIZE = SCREEN_SIZE / SIDE_CELLS; // 1マスの幅
var FPS = 200; // フレームレート
var canvas; // キャンバス
var context; // コンテキスト
var dirs = [ // アリの方向用配列
{'row': -1, 'col': 0},
{'row': 0, 'col': 1},
{'row': 1, 'col': 0},
#include "testApp.h"
void addFace(ofMesh& mesh, ofVec3f a, ofVec3f b, ofVec3f c) {
mesh.addVertex(a);
mesh.addVertex(b);
mesh.addVertex(c);
ofVec3f p0 = (a-b).getNormalized();
ofVec3f p1 = (b-c).getNormalized();
@jamiebullock
jamiebullock / LiveAudioProcessing.swift
Created June 19, 2014 07:45
Live coding audio with Swift Playgrounds
import Cocoa
import AVFoundation
// Setup engine and node instances
var engine = AVAudioEngine()
var delay = AVAudioUnitDelay()
var reverb = AVAudioUnitReverb()
var mixer = engine.mainMixerNode
var input = engine.inputNode
@kylemcdonald
kylemcdonald / main.cpp
Created April 24, 2014 22:06
Example of using libpcap with openFrameworks in monitor mode in OS X (probably similar on Linux). By default we are only watching for probe request frames.
// make sure to link against /usr/lib/libpcap.dylib
#include "ofMain.h"
#include <pcap/pcap.h>
class ofApp : public ofBaseApp {
public:
pcap_t *pcap;
struct pcap_pkthdr header;
const unsigned char* packet = NULL;
list<string> packetHex;
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-Noise.md
Last active April 25, 2024 12:16
GLSL Noise Algorithms

Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative

Generic 1,2,3 Noise

float rand(float n){return fract(sin(n) * 43758.5453123);}

float noise(float p){
	float fl = floor(p);
  float fc = fract(p);