Skip to content

Instantly share code, notes, and snippets.

@tado
tado / EneTable.pde
Created July 3, 2014 14:43
EneTable Class
// EneTable
// 電力データ読み込み用クラス
class EneTable {
String date; // 日付
int data[][]; // データ
// コンストラクタ(初期化関数)
// ファイルを指定して、データをパース
EneTable(String filename) {
@tado
tado / EneTableRead01.pde
Created July 3, 2014 14:49
EneTableRead01.pde
// ファイルを指定して電力データを読み込む
// クラス(Class)バージョン
EneTable ene;
void setup() {
// 画面初期化
size(800, 1004);
frameRate(30);
textSize(8);
@tado
tado / test.swift
Last active August 29, 2015 14:05
physics in playground
// This code worked width Xcode 6 Beta 6
import SpriteKit
import XCPlayground
let width:CGFloat = 480.0
let height:CGFloat = 800.0
let canvasWidth: UInt32 = UInt32(width)
let canvasHeight: UInt32 = UInt32(height)
@tado
tado / physics.swift
Created August 27, 2014 22:53
Swift + Playground physics
import SpriteKit
import XCPlayground
let width:CGFloat = 400
let height:CGFloat = 400
let canvasWidth: UInt32 = UInt32(width)
let canvasHeight: UInt32 = UInt32(height)
let view:SKView = SKView(frame:CGRectMake(0, 0, width, height))
let scene:SKScene = SKScene(size:CGSizeMake(width, height))
@tado
tado / swift3d.swift
Created August 28, 2014 07:15
Generative 3D for Swift Playground
import SceneKit
import XCPlayground
let width:CGFloat = 400
let height:CGFloat = 400
var view = SCNView(frame: CGRect(
x: 0,
y: 0,
width: width,
import SceneKit
import QuartzCore
class GameViewController: NSViewController {
@IBOutlet weak var gameView: GameView!
override func awakeFromNib(){
var scene = SCNScene()
@tado
tado / BlackmagicCapture.cpp
Last active February 3, 2018 13:22
Blackmagic capture example
#include "BlackmagicCapture.h"
BlackmagicCapture::BlackmagicCapture(int _width, int _height, float _framerate){
width = _width;
height = _height;
framerate = _framerate;
cam.setup(width, height, framerate);
colorTexture.allocate(width, height, GL_RGB);
fbo.allocate(width, height);
fbo.begin();
@tado
tado / realtime_fft.pde
Last active August 29, 2015 14:11
Realtime FFT Analysis for Processing
// Processing realtime FFT analysis
import processing.sound.*;
AudioIn input;
FFT fft;
int bands=512;
float[] spectrum = new float[bands];
public void setup() {
@tado
tado / ParticleVec3.cpp
Last active June 22, 2020 18:56
3D Particle for openFrameworks
#include "ParticleVec3.h"
ParticleVec3::ParticleVec3(){
radius = 5.0;
friction = 0.01;
mass = 1.0;
position.set(ofGetWidth()/2.0, ofGetHeight()/2.0, 0);
velocity.set(0, 0, 0);
acceleration.set(0, 0, 0);
minx = 0;
@tado
tado / touchMetaball.frag
Last active August 29, 2015 14:20
Draw metaball-like circles.
uniform float time;
uniform vec2 resolution;
uniform vec2 touches[10];
float circle(vec2 p, vec2 center, float r) {
float d = distance(p, center);
return 1.0 * r / d;
}
void main( void ) {