Skip to content

Instantly share code, notes, and snippets.

# 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\]"
@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],
@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
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)
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 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
# Andy Clymer’s DrawBot icon,
# slightly modified to work in Coldtype
# original source: https://www.drawbot.com/content/drawBotIcon.html
# modifications: moved timing and output to
# coldtype’s @drawbot_animation decorator
# to get drawbot in your virtualenv:
# pip install git+https://github.com/typemytype/drawbot
@stenson
stenson / plakato1.py
Last active April 9, 2022 13:45
playing with plakato and image feedback
from coldtype import *
from coldtype.fx.skia import phototype, luma, precompose, fill
from coldtype.warping import warp
fnt = Font.Find("PlakatoPlay.*I")
rs = random_series(0, 1000)
txt = "VERY\nVARI-\nABLE"
@animation((1080, 1080), tl=Timeline(60, 24), bg=0, render_bg=1, composites=1)
def plak2(f):
@stenson
stenson / plakato_draw_3d.py
Created December 29, 2021 02:41
plakato draw variating in 3d
from coldtype import *
from coldtype.blender import *
keyframes = dict()
for x in range(0, 4):
keyframes[f"{x}0"] = dict(ANIM=0)
keyframes[f"{x}1"] = dict(ANIM=1)
at = AsciiTimeline(2, 24, """
<
from coldtype import *
chars = "ABCDEFG"
count = len(chars)
fnt = Font.Cacheable("~/Type/fonts/fonts/plakato/PlakatoDraw.ttf")
@animation(timeline=Timeline(35*count, 30), bg=0, render_bg=1)
def animall(f):
e, lidx = f.e("qeo", count, loop_info=1)