Written in Mathematica. Probably can be ported to d3.js
Last active
December 10, 2015 00:59
-
-
Save mango314/4355233 to your computer and use it in GitHub Desktop.
Cool square-tiling thingy.
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
sq[{x_, y_}, r_] := { EdgeForm[Thick], | |
Polygon[{{x, y}, {x + r, y}, {x + r, y + r}, {x, y + r}, {x, y}}]} | |
t = 0.25; | |
a = Cos[t]; | |
b = Sin[t]; | |
motif[a_, b_] := ( | |
v = {b, a}; | |
w = {a, -b}; | |
x = {b, 0}; | |
{Blue, sq[0 v + 0 w, b], Red, sq[x, a]}) | |
tiling[s_] := | |
Graphics[Table[ | |
Translate[motif[Cos[2 Pi s], Sin[2 Pi s]], m w + n v], {m, 0, | |
5}, {n, 0, 5}]] | |
Export["*.gif", | |
Table[tiling[s], {s, 0, 0.5, 0.01}]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment