Friday, October 26, 2012

Re: AnimationScheduler.requestAnimationFrame example

I should probably mention that should you have the need to stop the
animation, you might have to implement your own logic. A couple of
lines of code would suffice in this case, but still.

I haven't tested 2.5 GA nor looked at the release notes for it yet but
if I am not mistaken even 2.4 had an issue where the animation doesn't
stop with the cancel method I think it was.

So just keep that in mind.

Regards,

Alfredo

On Fri, Oct 26, 2012 at 12:36 PM, Alfredo Quiroga-Villamil
<lawwton@gmail.com> wrote:
> Something along the lines of ... Notice the line under "Call it again."
>
> animation = AnimationScheduler.get().requestAnimationFrame(new
> AnimationCallback() {
> @Override
> public void execute(double timestamp) {
> // Do some stuff here
>
> // Call it again.
> AnimationScheduler.get().requestAnimationFrame(this);
> }
> }
> });
>
> Regards,
>
> Alfredo
>
> On Fri, Oct 26, 2012 at 8:43 AM, Arun <arunk.siluvery@gmail.com> wrote:
>>
>> Hi Everyone,
>>
>> I am beginning to learn WebGL development using GWT using gwtgl.
>> I am not able to get the requestAnimationFrame working to render my scene regularly.
>> Could someone please take a look at it and offer some advice?
>>
>> Code:
>>
>> Mygwtgl.java
>> public class Mygwtgl implements EntryPoint, AnimationScheduler.AnimationCallback {
>> ...
>> private Redraw redraw;
>> private void start() {
>> ...
>> redraw = new Redraw();
>> redraw.requestAnimationFrame(this);
>> }
>> public void execute(double timestamp) {
>> drawScene();
>> }
>> }
>>
>> Redraw.java
>> public class Redraw extends AnimationScheduler {
>> private AnimationScheduler.AnimationHandle hAnimScheduler;
>> public Redraw() {
>> hAnimScheduler = new AnimationScheduler.AnimationHandle() {
>> @Override
>> public void cancel() {
>> // TODO Auto-generated method stub
>> }
>> };
>> }
>> public AnimationScheduler.AnimationHandle requestAnimationFrame(AnimationScheduler.AnimationCallback cb, Element e) {
>>
>> // cb.execute() works here but only once, not getting scheduled regularly
>> //
>>
>> return hAnimScheduler;
>> }
>> }
>>
>> I do not have much programming experience with java and I am not sure whether this is the correct way to use requestAnimationFrame().
>> The callback doesn't seem to be scheduled,
>> I really appreciate any advice in this regard.
>>
>> -br
>> Arun
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
>> To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/-y4hkIDt5BUJ.
>> To post to this group, send email to google-web-toolkit@googlegroups.com.
>> To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
>> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>
>
> --
> Alfredo Quiroga-Villamil
>
> AOL/Yahoo/Gmail/MSN IM: lawwton



--
Alfredo Quiroga-Villamil

AOL/Yahoo/Gmail/MSN IM: lawwton

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment