[Sugar-devel] Web activity example that uses html5 canvas
Manuel Quiñones
manuq at laptop.org
Tue Apr 30 07:51:22 EDT 2013
2013/4/30 James Cameron <quozl at laptop.org>
>
> On Mon, Apr 29, 2013 at 10:42:40PM -0300, Manuel Qui?ones wrote:
> > 2013/4/29 James Cameron <quozl at laptop.org>:
> > > On Mon, Apr 29, 2013 at 04:23:24PM -0300, Manuel Qui?ones wrote:
> > >> And here a live demo:
> > >>
> > >> http://manuq.github.io/clockjs/activity.html
> > >
> > > Should this work if opened on Firefox 20.0 on Ubuntu 12.10?
> > >
> > > (It shows a clock face, but no arms.)
> >
> > It is because of requestAnimationFrame. To make it compatible with
> > all current browsers , I could do:
> >
> > var requestAnimationFrame = window.requestAnimationFrame ||
> > window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame
> > || window.msRequestAnimationFrame;
> >
> > I certeanly dislike doing such things for compatibility :) If we are
> > targetting webkit for now, and webkit has the generic one, I suppose
> > I'll go with that. It is just time for the other browsers to get it.
> > What do you think?
>
> Tested also on an Android tablet with the Browser app, the javascript
> console reported "Uncaught ReferenceError: requestAnimationFrame is
> not defined". So this is the same thing.
>
> I think code that might be executed in the wrong environment should at
> least say why it won't run, rather than fail silently.
>
> Otherwise, add a condition when you publish a live demo: "intended to work in
> ${browser} only". ;-)
Thanks for your advice. This should be considered when writting web
activities then.
> > Here are links for the mozilla page of the feature, and w3 the specification:
> >
> > https://developer.mozilla.org/en/docs/DOM/window.requestAnimationFrame
> > http://www.w3.org/TR/animation-timing/#requestAnimationFrame
>
> Thanks.
>
> --
> James Cameron
> http://quozl.linux.org.au/
--
.. manuq ..
More information about the Sugar-devel
mailing list