Re:Scrub values in JavaScript live
by mutewinter on Wednesday November 28, 2012 @07:28AM
(#4842174)
I did something like this in my presentation[1] about Ember.
It uses Ember.js to maintain the state of the code samples and proved to be very stable. I don't have interactive sliders on specific values, but the code is parsed and run after every character the user types. e.g. you can change the size of the squid on this page[2] and see it reflected immediately on the right.
[1]: http://mutewinter.github.com/why_ember/#/slides
[2]: http://mutewinter.github.com/why_ember/#/slides/data-binding
It isn't really intended for production use. Personally, I plan to use it to tweak values in games I write, because having to alt+tab, find, edit, alt+tab, refresh, restore state for every tiny tweak to the position of a UI element sucks.
This is a development tool :)
Can you go into more detail?
I would highly recommend watching this, and keeping in mind how such a thing could be useful in games.
http://worrydream.com/#!/InventingOnPrinciple
For a concrete example of usefulness in games, see
It would be useful to give a pitch as to why I should watch it - it's an hour long.
Because it's an awesome lecture and well worth a good hour of your life. Trust us on this one, but it's your loss if you don't. :)
If it helps, you can read the comments from when it was posted and got 221 points:
Re:Scrub values in JavaScript live
by cocoflunchy on Wednesday November 28, 2012 @05:00AM
(#4841776)
It's really one of the best ways you can spend an hour imho.
You could do exactly the same using very simple Knockout. It wouldn't be as funky, but it would be something you'd be happy to use in production.