Skip to content

Instantly share code, notes, and snippets.

@n1ckfg
n1ckfg / Favorites.pde
Last active November 7, 2017 16:56
Favorite Processing functions
float getAngle(PVector p1, PVector p2){
PVector a = PVector.sub(p2,p1);
float aa = abs(degrees(atan2(a.x,a.y)) - 180);
return aa;
}
String setOnOff(boolean _b){
String s;
if(_b){
s = "ON";
@n1ckfg
n1ckfg / animation_speed_control.pde
Last active November 7, 2017 16:58
Use modulo to time actions independently of frame rate
int frameDivider = 1;
void setup(){
size(640,480);
frameRate(24);
}
void draw(){
if (frameCount % frameDivider == 0) {
background(random(255));
@n1ckfg
n1ckfg / maya_objseq.py
Last active November 7, 2017 16:58
Turn object sequence on and off in Maya
from maya.cmds import *
numObjs = 19
objPrefix = "vectorsquid"
objSuffix = ":polySurface1"
t = 0
tDelta = 5
for i in range(numObjs):
currentTime(t)
@n1ckfg
n1ckfg / Tools_Eyebeam.md
Last active March 31, 2018 15:32
Eyebeam repos, May 2012-Jan 2013
PVector p = new PVector(320, 240);
PVector t = p;
PVector e = new PVector(100, 100);
void setup() {
size(640, 480);
noCursor();
}
void draw() {
@n1ckfg
n1ckfg / appfolder.pde
Last active November 7, 2017 16:58
Open the app's folder in Processing, cross-platform
import java.awt.Desktop;
void setup(){
openAppFolderHandler();
}
void openAppFolderHandler(){
String os = "Mac OS X";
try{
os = System.getProperty("os.name");
# encoding: utf-8
require "rubygems"
require "twitter"
rClient = Twitter::REST::Client.new do |config|
config.consumer_key = ""
config.consumer_secret = ""
config.access_token = ""
config.access_token_secret = ""
end
// get sample brushes from
// http://fox-gieg.com/stuff/for/recurse/brush_examples.zip
// brush path code by Amnon Owed
// http://forum.processing.org/one/topic/help-starting-bitmap-trace.html
PImage img;
int numDrawers = 1000; //points drawn per frame--use lots
int numDrawerReps = 1;//scatter points per point--use sparingly
@n1ckfg
n1ckfg / setup_artistic-videos.md
Last active September 24, 2018 02:35
Artistic-Videos Setup

SETUP for ARTISTIC-VIDEOS on Ubuntu 16.04 / 180923 https://github.com/manuelruder/artistic-videos

  1. Sign up for an Nvidia developer account to get CUDA and CuDNN. You probably want CUDA 8 and CuDNN 5.

  2. Install CUDA. DO NOT update Nvidia graphics driver when asked! (It'll break Ubuntu.) DO use a symlink for the location when asked--that lets you have multiple CUDA/CuDNN installations on your machine.

  3. If you accidentally updated the graphics driver, you'll appear to be locked out of Ubuntu. Don't panic; it just can't launch the GUI past your login screen. Boot to terminal and remove all your Nvidia drivers with:

sudo apt-get purge nvidia*
@n1ckfg
n1ckfg / gp2_utils.py
Last active November 7, 2017 16:59
Blender Grease Pencil 2 utility functions
def getActiveGp(_name="GPencil"):
try:
pencil = bpy.context.scene.grease_pencil
except:
pencil = None
try:
gp = bpy.data.grease_pencil[pencil.name]
except:
gp = bpy.data.grease_pencil.new(_name)
bpy.context.scene.grease_pencil = gp