The Fade In works nicely, but unfortunately Slide Down doesn't, at
least not on Firefox 3.0.8 on Windows. Error:
Error: elt.getHeight is not a function
Source File: effects.js
Line: 13
[Heading out of town in the AM, so can't investigate more right now
I'm afraid, but hopefully this is useful.]
Shriram
2009/4/17 noel...@gmail.com <noel...@gmail.com>:
> I've just uploaded my (very small, very incomplete) animation library
> Flan:
>
> http://github.com/noelwelsh/flan/
That's great job. :)
I have a question: why did you use event streams instead of behaviors?
Is this because of performance?
I looked at a wide variety of javascript animation libraries out there,
and it seems like they all eat CPU like candies. What is interesting
here is the fact that the results of profiling code samples that I
posted before indicate that DOM updates are inefficient, and it
looks like there's nothing we can do about that...
For example, it turned out that an assignment to window.location.hash
is so slow that I had to "isolate" it in a setTimeout(fun,0). That doesn't
help much, ewww. :(
You can take a look at a somewhat simplified version here:
<http://www.sound-city.kz/fj/flapjax.html>
(doesn't work in IE only because of my laziness)
Also, I've written articles about Flapjax and animation
using Flapjax in Russian:
<http://chiaroscuro.yvision.kz/blog/9161.html>
<http://chiaroscuro.yvision.kz/blog/9169.html>
<http://chiaroscuro.yvision.kz/blog/9468.html>
If anybody is interested, I can as well translate them to English.
The bottom line is: don't overuse animations. :) If one needs a lot
of animation, then they should resort to Flash, I suppose.
Cheers,
Artyom Shalkhakov.
PS sorry for the late reply. I was very busy finishing my first
Flapjax-powered website. :)
I think this is the right. I believe that UI widgets are
significantly harder than animations and push the language and its
abstractions much further
I thought I'd give a simple data grid a shot (Safari 4, Firefox 3):
http://www.cs.brown.edu/~arjun/tmp/table.html
There are some inefficiencies I've noted in the source. In addition,
the code would be a lot cleaner if we had a generalized version of
tagRec that worked with multiple elements.
In this grid, I care about clicks on the <table> and keyboard events
on the <textarea>. The structure of the <table> is dependent on
enterKeyE's on the <textarea>. Since tagRec just works with a single
element, I had to use sendEvent (table.js:128).
Arjun
http://www.flapjax-lang.org/demos/catchup.html
Here's catchup using a different implementation of Flapjax:
http://www.cs.brown.edu/~arjun/tmp/catchup.html
It should feel smoother. Specifically, in the old catchup, if you
move the mouse fast, the word "up" gets frozen in place, and moves
around erratically.
With the new Flapjax, "up" should freeze a lot less.
Technical details:
The problem with catchup is the use of timerB and delayB: popular
functions for animations. timerB and delayB are implemented with
JavaScript's setInterval and setTimer. When you move the mouse really
fast, the flurry of UI events supersede the scheduled
setTimer/setInterval events, so the delayed "up" gets stuck. We talk
about "glitches" in a single timestep. IMO, this is a glitch-like
thing.
I've reimplemented the scheduler so that events can be scheduled for
the future. delayB no longer creates a new callback for each event.
Instead it simply schedules them for the future.
What we have now is just a reimplementation of delayB and a new
scheduler. If this looks promising, I'll go ahead and fix timerB. As
I see it, timerB, delayB and other such functions would all just
schedule events for the future. Flapjax would have a single
setInterval timer callback whose resolution would be the minimum
resolution used by the program.
Arjun