Skip to content

Instantly share code, notes, and snippets.

from coldtype.test import *
import wave, struct, math, random, pickle
"""
Run in terminal: `coldtype sonification.py`
After a render_all (aka hitting the `a` key in the viewer app),
this code will render individual wave files for each letter,
to the renders/sonification/ folder
from coldtype import *
co = Font.Cacheable("assets/ColdtypeObviously-VF.ttf")
@animation((1500, 800), timeline=Timeline(60, fps=23.976))
def var(f, depth=0):
t = f.a.progress(f.i, loops=1, easefn="qeio")
cold = (StyledString("COLDTYPE",
Style(co, 800-t.e*700, wdth=t.e, ro=1, tu=-90+t.e*50, r=1))
from furniture.animation import Animation
def draw_1(frame):
fill(0, 0.5, 1)
rect(*frame.page)
def draw_2(frame):
fill(1, 0, 0.5)
rect(*frame.page)
@stenson
stenson / textonapath.py
Last active March 23, 2019 17:46
some code for almost very accurately setting text on a path
# for path-segmenting
from fontTools.misc.bezierTools import calcCubicArcLength, splitCubicAtT
from fontTools.pens.recordingPen import RecordingPen
import math
# for text layout internals
from drawBot.context.baseContext import BaseContext
import CoreText
import AppKit
import Quartz
@stenson
stenson / speakers.py
Created February 27, 2019 01:21
recreating the very cool typographics 2019 "speakers announced" gif with drawbot
from furniture.animation import Animation
from furniture.vfont import scale_to_axis
from grafutils.text.lockup import GlyphLockup # currently unavailable publicly, in-development
from drawBot import *
colors = [
[1.0, 0.0, 0.48],
[1.0, 0.89, 0.15],
[0.07, 0.69, 0.94],
[0.14, 0.69, 0.64],
# Git Branch in Prompt
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local LIGHT_BLUE="\[\033[1;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"
local GREEN="\[\033[0;32m\]"