Skip to content

Instantly share code, notes, and snippets.

View calebj0seph's full-sized avatar

Caleb Joseph calebj0seph

View GitHub Profile
@calebj0seph
calebj0seph / material-easing.js
Last active July 27, 2019 23:25
Material Design easing functions implemented using only math operations in JavaScript
function materialEase(x) {
// cubic-bezier(0.4, 0.0, 0.2, 1)
const a = Math.pow(8*Math.sqrt(400*x*x-225*x+37)+5*(32*x-9),1/3);
const t = (a*a+3*a-7)/(8*a);
return -t*t*(2*t-3);
}
function materialEaseOut(x) {
// cubic-bezier(0.0, 0.0, 0.2, 1)
let t = 0;
@calebj0seph
calebj0seph / gist:9305873
Created March 2, 2014 12:30
An audio visualisation generator. To use, open Blender and go to the Text Editor. Copy/paste the code and call bake_visualisation_circle() with the desired parameters.
import bpy
from math import e, pi, cos, sin
def frequency_distribution(min_val, max_val, step, max_step):
sharpness = 6
return min_val + ((e**((sharpness*step)/max_step) - 1)/(e**sharpness - 1)) * (max_val - min_val)
def bake_visualisation_circle(bars: int=50, repetitions: int=3,
radius: float=2.0, bar_depth: float=1.0, bar_height: float=2.0,
bar_offset: float=0.0, bar_separation: float=0.0,