原文
原始链接: https://news.ycombinator.com/item?id=40141777
本文描述了创建一种用于生成与音乐同步的视觉模式的软件的早期尝试。 作者以最简单的形式设计了一个系统,使用称为“模具”的基本形状,可以将其焊接在一起。 他将位置或颜色变化等过渡与“图案序列”联系起来。 通过绘制所有模具并根据节拍数应用过渡,他的目标是产生与音乐同步的视觉上吸引人的结果。 然而,随着思想的进展,创作者意识到矩形、线条和过渡都是由更简单的元素组成的。 四年后,虽然目标依然存在,但由于涉及的复杂性,该项目进展甚微。 相反,作者描述了一种更新的方法,利用互连的“节点”或“变压器”来表示输入、处理阶段和结果。 这些节点遵循链接结构,允许多个变压器同时相互影响。 通过在两个序列之间递归地应用变换,可以出现新颖的结果,使得该过程既是线性的又是分层的。 此外,用户可以选择序列的特定部分来关注,从而实现高效探索,而无需计算整个序列。 虽然很复杂,但这个概念为抽象形状生成、尺寸操纵、旋转、复制和各种投影提供了机会。
Basically you have some basic shapes like lines, rectangles and you can "weld" them together to form a mold, which could be joined together with other molds.
Then I created a pattern sequence with some basic transitions, like swapping positions or colors. https://github.com/ando818/creativegen/blob/master/pattern.p...
The program would then draw all the molds, and every 4,8,16, or whatever beats apply the transition from the pattern sequence. Ie every 4 beats swap, every 8 bits change colors. The idea was that you could form the pattern sequence quite easily and create interesting visuals that synced with music. I have some videos somewhere of this thing running, just not sure where they are.
Then I started thinking rectangles are really just composition of lines, lines are just composition of points. Transitions are just compositions of other transitions and I wanted to make everything out of the same thing. 4 years later honestly I don't have much to show for it. Its proven incredibly difficult and my ideas are all over the place. I've created literally 10-20 different implementations and started all over again. This is one of them.
https://pastebin.com/4J8dgAWu The idea is that each node (pixel, object, or whatever) is a "transformer" which has a start and end which themselves are transformers with a start, end, next. Following a transformer's start transformer's next pointer should lead to its End (think input, transformation sequence, output). We run a transformer A with an instance of a different transformer B. We iterate through the nexts of A's transformer and Bs transformer concurrently, at each step we apply the transformation from the A sequence to the B sequence. So for example, image B.start = 0, B.start.next = 1. And A.start = SameTransformer (copies the same value to the output) -> Diff Transformer(flips the bit). So running A.run(B) = a new transformation that takes the sequence 0,1, and returns 0,0. This new transformer C could then of course be used elsewhere as a part of another transformation sequence. So to transform 0,0,0,0, one could simply apply C,C to get transformer whose output is 0,1,0,1.
Its both linear and hierarchical, so one has the ability to jump over large steps (by immediately accessing the output, and not running through Start->End) of transformations if one is only interested in the outputs and not the computational steps that lead to that output. The hierarchy also allows the sequence to be treated as a single node as part of another sequence (hence applying Same to a subsequence can call same on everything below to copy it).
Ive used 0s and 1s here but instead imagine 0=Right and 1=Up. Then you can have a sequence of nexts that is something like right->up->right-up->up and run this as the input to a transformer that simply applies Same, Diff, replicating the sequence, and then copying the last value to get right->up->right-up->up->up.
So now imagine we make a transformer that flips the current bit, and the next bit (Diff, diff) and run it through the sequence 1,0,0,0,0,0. If we look at the output at each transformation step, we get 0,1,0,0,0 -> 0,0,1,0,0,0... But since were simply following the next path of any arbitrary sequence, this transformer could be run over the right-up->right->-up->up sequence, producing a visual with each of these nodes changing color one at a time.
The bigger idea is to generate abstract sequences that make stuff bigger and bigger, or rotate them, or pull them apart, or replicate them in some projection etc.
Of course there is a simple way to do this in existing languages that would take short of 10 seconds :->
There's still plenty to think about it. If that's confusing welcome to my world.