Skip to content

Instantly share code, notes, and snippets.

View johnanthonyevans's full-sized avatar

John Anthony Evans johnanthonyevans

View GitHub Profile
@johnanthonyevans
johnanthonyevans / gist:68379b4c2e97aa0eca28
Last active August 29, 2015 14:10
Animating an arbitrary property in framers
Function::property = (prop, desc) ->
Object.defineProperty @prototype, prop, desc
class testLayer extends Layer
constructor: (options = {}) ->
super options
@property 'angle',
get: -> @_angle
set: (angle) ->
@johnanthonyevans
johnanthonyevans / gist:014a98084b73ec89b282
Last active August 29, 2015 14:10
Provides an audio layer for framerjs. Totally stolen from the framer source
# Copied mostly from the framer source which at this time is here https://github.com/koenbok/Framer/blob/master/framer/VideoLayer.coffee
class AudioLayer extends Layer
constructor: (options={}) ->
super options
@player = document.createElement("audio")
@player.setAttribute("preload", "auto")
class InputTextLayer extends Framer.Layer
constructor: (options) ->
super options
@ignoreEvents = false
@input = document.createElement("input")
_.extend @input.style,
@johnanthonyevans
johnanthonyevans / gist:11008209
Last active August 29, 2015 14:00
Resize images in folder quickly
sips -Z 640 640 *.JPG
// this script moves the selected object it's given distances (command ')
var input = [doc askForUserInput:"Transform (X,Y)" initialValue:0];
var flags = [NSEvent modifierFlags];
// should validate the input here
var x_delta = eval(input.split(",")[0]);
var y_delta = eval(input.split(",")[1]);
// this script moves the selected object it's given distances (command ')
// var levels = dialog(" ", 0, "Transform'" + [layer name] + "'(x,y)");
var levels = dialog(" ", 0, "Transform Object (x,y)");
/**
* Open a dialog for user input
* @param {string} msg The dialog message
* @param {mixed} given String or number - the given input value
* @param {string} title The dialog title
* @return {string} The value the user entered in the dialog