Last active
June 12, 2020 08:19
-
-
Save makyo/32c120a0b66e6d4c0672563a6aaf2de4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import random | |
import sys | |
from utils import block, clearpage | |
class cell: | |
def __init__(self, text, sides=3, iter=3, max=20, delay=0, jitter=0.0): | |
self.text = text | |
self.words = text.split() | |
self.sides = sides | |
self.iter = iter | |
self.max = max | |
self.delay = delay | |
self.jitter = jitter | |
self.step_jitters = [0 for _ in range(0, self.sides)] | |
self.step = 0 - self.delay | |
self.countdown = self.iter | |
def next(self): | |
if self.delay > 0: | |
self.delay -= 1 | |
self.step += 1 | |
print('%s delaying...' % self.text, file=sys.stderr) | |
return True | |
if self.step >= self.max: | |
self.countdown -= 1 | |
if self.countdown < 0: | |
return False | |
if self.step < self.iter: | |
print('%s running...' % self.text, file=sys.stderr) | |
block(self.text, 0.06, 1.2, 0.5, 0.5, 0) | |
for side in range(0, self.sides): | |
base_angle = 360 * ((side + 1) / (self.sides)) | |
for sparkle in range(0, self.step if self.step < self.iter else self.iter): | |
distance = sparkle | |
if self.step > self.iter: | |
distance += self.step - self.iter | |
self.step_jitters[side] += random.randint(-30, 30) * self.jitter | |
block((self.text + " ") * self.sides, | |
0.03, | |
1.2, | |
0.5 - (0.3 + distance / 100) * math.cos(math.radians(base_angle + 5 * distance + self.step_jitters[side])), | |
0.5 + (0.3 + distance / 100) * math.sin(math.radians(base_angle + 5 * distance - self.step_jitters[side])), | |
base_angle + 4 * distance + self.step_jitters[side]) | |
self.step += 1 | |
return True | |
def perhaps(fragment, shape, insecurity=0): | |
if shape > 1: | |
for i in range(0, shape + 1): | |
are_we_sure = insecurity | |
turn = 360.0 * ((i + 1) / (shape + 1)) | |
for j in range(0, 200): | |
if insecurity > 0: | |
are_we_sure += random.randint(-30, 30) * insecurity | |
block((fragment + " ") * (8 - shape), | |
0.03, | |
1.2, | |
0.5 - (0.3 + j / 100) * math.cos(math.radians(turn + 5 * j + are_we_sure)), | |
0.5 + (0.3 + j / 100) * math.sin(math.radians(turn + 5 * j - are_we_sure)), | |
turn + 4 * j + are_we_sure) | |
block(fragment, 0.06, 1.2, 0.5, 0.5, 0) | |
clearpage() | |
def is_god(): | |
sentiment = 'god is between me and my heart'.split() | |
lines = [ | |
perhaps(' '.join(sentiment[0:increasingly + 1]), increasingly) | |
for increasingly in range(0, len(sentiment))] | |
def what_it_is_not(): | |
sentiment = 'god is not a part of me'.split() | |
lines = [ | |
perhaps(' '.join(sentiment[0:7 - increasingly]), 7 - increasingly - 1, insecurity=0.07) | |
for increasingly in range(0, len(sentiment))] | |
def but_what_if(): | |
sentiment = 'i stand apart from myself'.split() | |
lines = [ | |
perhaps(' '.join(sentiment[0:increasingly + 1]), increasingly, insecurity=0.09) | |
for increasingly in range(0, len(sentiment))] | |
def i_had_a_stance(): | |
sentiment = 'and god cannot stop me'.split() | |
lines = [ | |
perhaps(' '.join(sentiment[0:increasingly + 1]), 5 - increasingly, insecurity=0.5) | |
for increasingly in range(0, len(sentiment))] | |
def dril(): | |
sentiment = 'i will face god and walk backwards into hell'.split() | |
lines = [ | |
perhaps(' '.join(sentiment[0:increasingly + 1]), 9 - increasingly, insecurity=0.07) | |
for increasingly in range(0, len(sentiment))] | |
def dril_anim(): | |
cells = [ | |
cell('IF THE ZOO BANS ME', sides=3, iter=20), | |
cell('FOR HOLLERING AT THE ANIMALS', sides=3, iter=20, max=50, delay=20), | |
cell('I', sides=3, iter=10, delay=60), | |
cell('I WILL', sides=4, iter=10, delay=70), | |
cell('I WILL FACE', sides=4, iter=10, delay=80), | |
cell('I WILL FACE GOD', sides=5, iter=15, delay=90, jitter=0.03), | |
cell('AND WALK', sides=6, iter=10, delay=105, jitter=0.04), | |
cell('AND WALK BACKWARDS', sides=7, iter=15, delay=115, jitter=0.04), | |
cell('AND WALK BACKWARDS INTO', sides=8, iter=10, delay=130, jitter=0.05), | |
cell('AND WALK BACKWARDS INTO HELL', sides=9, iter=30, delay=140, jitter=0.05)] | |
while True: | |
res = False | |
for c in cells: | |
curr = c.next() | |
res = res or curr | |
clearpage() | |
if not res: | |
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def block(text, fontsize, lineheight, v, h, r): | |
print('%%\n'.join((r'\begin{textblock*}{\paperwidth}[0.5,0.5](%0.4f\paperwidth,%0.4f\paperwidth)', | |
r'\begin{center}', | |
r'\rotatebox[origin=c]{-%0.4f}{{\fontsize{%0.4f\paperwidth}{%0.4f\paperwidth}\selectfont{}%s}}', | |
r'\end{center}', | |
r'\end{textblock*}')) % (h, v, r, fontsize, fontsize * lineheight, text)) | |
def clearpage(): | |
print('\\mbox{}\\clearpage\n') | |
def newpage(): | |
print('\\newpage\n') | |
def begin(): | |
print(r''' | |
\documentclass[11pt]{memoir} | |
\usepackage[absolute, overlay]{textpos} | |
\usepackage{graphicx} | |
\usepackage[ | |
paperwidth=8.5in, | |
paperheight=8.5in, | |
layoutwidth=8.5in, | |
layoutheight=8.5in, | |
includeheadfoot, | |
twoside | |
]{geometry} | |
\begin{document} | |
'''.strip()) | |
def end(): | |
print(r'\end{document}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Makyo does horrible, horrible things with LaTeX, gets perhaps the best warning ever: "I can't work with sizes bigger than about 19 feet." Whups, messed up -some- unit in there :P | |
Kianir murmurs, "That's a weird limitation." | |
Lhyton_Tucker says, "And there are folks here - mainly otters - who say, 'Nineteen feet? That's nothing.'" | |
You yerf, "Wonder if there's an internal representation of units that's just like...a uint8 or something." | |
You yerf, "And 19' worth of the smallest unit is just like ghjlkdsljfillion" | |
Kianir murmurs, "It's nothing round to a power of 2 in millimeters." | |
Kianir hmms. It is about 2^14 points though. | |
You yerf, "At 300dpi, that's bigger than 2^16 pixels" | |
You yerf, "So maybe that?" | |
Kianir murmurs, "Lord Knuth would never permit such units!" | |
Makyo snrk! "But this was pdftex complaining. dvips could probably handle it!" | |
Makyo drops a number, cheers! There we go. More algebra than she ever thought she'd use writing poetry ever :P | |
Kianir murmurs, "You're the most meta person I've ever met." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment