diff --git a/05/animate.js b/05/animate.js new file mode 100644 index 0000000..4f52d53 --- /dev/null +++ b/05/animate.js @@ -0,0 +1,35 @@ + +const pointer = { x: 0, y: 0 }; + +window.addEventListener( + "pointermove", + (e) => { + pointer.x = e.clientX; + pointer.y = e.clientY; + }, + false +); + +const paths = document.getElementsByTagName("path"); +const svg = document.getElementsByTagName("svg")[0]; + +console.log(paths); +function animate() { + requestAnimationFrame(animate); + const rect = svg.getBoundingClientRect(); + const x = pointer.x - rect.left; + const y = pointer.y - rect.top; + for( const path of paths ) { + const i = Number(path.getAttribute("id")); + const xk = 0.004 * x; + const yk = 0.004 * (y + i - 200); + path.setAttribute( + "transform", `translate(${x}, ${y}) scale(${xk},${yk}) rotate(${xk * i * 2},20,20)` + ); + } +} + +animate(); + + + diff --git a/05/genuary05.py b/05/genuary05.py index 20c3214..b5d872c 100755 --- a/05/genuary05.py +++ b/05/genuary05.py @@ -1,6 +1,7 @@ #!/usr/bin/env python COORDS = 'coords.txt' +import copy def load_coords(): data = [] @@ -8,24 +9,60 @@ def load_coords(): for line in cfh: parts = line[:-1].split(" ") datum = { "command": parts[0] } - datum["points"] = [ float(p) for p in parts[1:] ] + points = [] + for i in range(int((len(parts) - 1) / 2)): + points.append((float(parts[1 + i * 2]), float(parts[2 + i * 2]))) + datum["points"] = points data.append(datum) return data def coords_string(coords): - return " ".join([ coords["command"] ] + [ str(f) for f in coords["points"] ]) + return " ".join([ coords["command"] ] + [ f"{x} {y}" for x, y in coords["points"] ]) -def coords_to_path(coords, r, g, b): +def coords_to_path(coords, i, r, g, b): d = " ".join([ coords_string(c) for c in coords ]) - svg = f'\n' return svg +def apply_transform(command, f): + new_data = { + "command": command["command"] + } + new_data["points"] = [ f((x, y)) for x, y in command["points"] ] + return new_data data = load_coords() -print('') +print(""" + + + etc.mikelynch.org | Genuary 2026 + + + -print(coords_to_path(data, 255, 0, 0)) +
+ +

Genuary 2026 - 05

+ +

Write "Genuary". Avoid using a font

+ + +""") + +for i in range(-100, 100, 5): + warp = lambda p: (p[0], p[1] + i * 0.02 * p[1]) + new_data = [ apply_transform(command, warp) for command in data ] + print(coords_to_path(new_data, i, 255, 128 + i, 0)) + +print(""" + + + + + + +""") -print("") diff --git a/05/index.html b/05/index.html new file mode 100644 index 0000000..6540357 --- /dev/null +++ b/05/index.html @@ -0,0 +1,105 @@ + + + + etc.mikelynch.org | Genuary 2026 + + + + +
+ +

Genuary 2026 - 05

+ +

Write "Genuary". Avoid using a font

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dist/05/animate.js b/dist/05/animate.js new file mode 100644 index 0000000..4f52d53 --- /dev/null +++ b/dist/05/animate.js @@ -0,0 +1,35 @@ + +const pointer = { x: 0, y: 0 }; + +window.addEventListener( + "pointermove", + (e) => { + pointer.x = e.clientX; + pointer.y = e.clientY; + }, + false +); + +const paths = document.getElementsByTagName("path"); +const svg = document.getElementsByTagName("svg")[0]; + +console.log(paths); +function animate() { + requestAnimationFrame(animate); + const rect = svg.getBoundingClientRect(); + const x = pointer.x - rect.left; + const y = pointer.y - rect.top; + for( const path of paths ) { + const i = Number(path.getAttribute("id")); + const xk = 0.004 * x; + const yk = 0.004 * (y + i - 200); + path.setAttribute( + "transform", `translate(${x}, ${y}) scale(${xk},${yk}) rotate(${xk * i * 2},20,20)` + ); + } +} + +animate(); + + + diff --git a/dist/05/index.html b/dist/05/index.html new file mode 100644 index 0000000..6540357 --- /dev/null +++ b/dist/05/index.html @@ -0,0 +1,105 @@ + + + + etc.mikelynch.org | Genuary 2026 + + + + +
+ +

Genuary 2026 - 05

+ +

Write "Genuary". Avoid using a font

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +