Message from JavaScript discussions

September 2018

— Not twice, it's different, but changes same variable

— 

do
# WARNING: conditional jumps overwrite position
# get interpolation range
for b in q.range when p < b.end
break
# count active
c = 0
for a in b.2
++c if b.active
# check no interpolation
if c == 0
# in the middle position,
# jump to the next range
if p < duration
p = a.end
scale = p / duration
continue
# in the final position,
# everything was completed earlier
break
# REVERT animations
# when playhead set backwards,
# some animations should revert to its initial state
# and no callbacks should be triggered in this process
for a in b.0 when a.started
a.update -1, true
# INTERPOLATE animations
# count of active animations may be reduced
for a in b.2 when a.active
# determine animation scale and update
# animation may deactivate itself
--c if not (a.active = a.update ((p - a.position) / a.duration), noCallback)
# COMPLETE animations
for a in b.1 when a.active
a.update 1, noCallback
# check no interpolation
if c == 0 and p < duration
# jump to the next range
p = b.end
scale = p / duration
continue
while false

— That's actual working draft

— What language is this?

— It's livescript

— Quite understandable, right

— It looks terribly stateful

— Only one state in the loop, c

— Gruesome

— Hell yeah!

— I cant apply fragile do..while logic here

— Turn it into recursion instead