I am trying to understand the loop in this Processing syntax:
t=0
draw=_=>{t||createCanvas(W = 720,W)
t+=.01
B=blendMode
colorMode(HSB)
B(BLEND)
background(0,.1)
B(ADD)
for(y = 0; y < W; y += 7)
for(x = 0; x < W; x+=7)
dist(x, y, H = 360, H) +
!fill(x * y % 360, W, W,
T=tan(noise(x, y) * 9 + t))
< sin(atan2(y - H, x - H) * 2.5 + 84)**8 * 200 + 130?
circle(x, y + 30, 4/T) : 0}
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.5.0/p5.js"></script>
from here.
I am making great progress, and I get now that the ending :0
is the ifelse
of the Boolean in ?
, but I want to focus solely on the t
counter.
First off, it doesn't seem that t
has any endpoints: it simply keeps incrementing.
Second, I see that the image that it would produce with a very stripped down code like this:
t=0
draw=_=>{t||createCanvas(W = 720,W)
t+=.01
console.log(frameCount)
for(y = 0; y < W; y += 70)
for(x = 0; x < W; x+=70)
circle(x+random(10,20), y+ random(10,20) + 30, 30)}
is
whereas commenting out the t+=.01
produces constant wiggling between frames but no double contours:
plus the background is different.
Therefore I deduct that t+=.01
somehow concatenates each frame so that the information of one frame is overlapped on the previous until the new circles obscure the previous ones.
But does each frame start producing all the prior information from the very start t=0
? Or is there a latency between frames, or somehow superimposition? How is the memory of previous frames retained? I see that t
is a loop, so I guess the span of the iterations keeps on growing in each frame, and becomes larger and larger, but always starting at t=0
?
A simple hacking test is to run:
t=0
draw=_=>{t||createCanvas(W = 720,W)
t +=0.01
console.log(frameCount)
for(y = 0; y < W; y += 2)
for(x = 0; x < W; x+=2)
point(x+ random(0,frameCount), y+ random(0, frameCount))}
to see how quickly the entire canvas becomes homogeneously black, because each t
(with t +=.01
operational) paints on top of the previous frame as in an infinity loop.