Animated state in Underreact

14 views
Skip to first unread message

Ross Angle

unread,
Sep 24, 2013, 2:20:13 AM9/24/13
to reactiv...@googlegroups.com
Hi all,

Over the past few days, I've added a few new test pages to the Underreact project. The newer ones use <canvas> and glorious Pong-style graphics. Today I wrote an animated state primitive and hooked it up to the position of a dot on the canvas. It's nice to finally get some visual feedback for these concepts. :)

Look for the links in the readme: https://github.com/rocketnia/underreact

Right now, the animated dot's state transitions are as follows:

If the state is 0, change the state to 1 and rest for 300ms.
If the state is 1, change the state to 2 and rest for 300ms.
If the state is 2, change the state to 0 and rest for 300ms.

All rules must be of the form "If the state is ___, change the state to ___ and rest for ___ms," represented as a JavaScript Array containing three numbers.

This isn't quite the same as what David described, because these rules put the system into a debt that must be recovered, rather than consuming an ever-growing resource. I don't consider this a positive innovation, necessarily. I was just implementing this from memory, and I was ready to settle for anything that worked well enough to animate a dot. :-p

-Ross

(P.S.: I'm still working on a reply to the "Staging for PL/UI Synthesis" thread, but it might take a while. My own opinions are in flux right now, and my attention's drifted over to things like this.)

David Barbour

unread,
Sep 24, 2013, 2:40:20 AM9/24/13
to reactiv...@googlegroups.com
Visual feedback from a live program is always one of those wonderful steps. :)

Best,

Dave

--
You received this message because you are subscribed to the Google Groups "reactive-demand" group.
To unsubscribe from this group and stop receiving emails from it, send an email to reactive-dema...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages