dwitter icon indicating copy to clipboard operation
dwitter copied to clipboard

Wish List: Frame Counter

Open aemkei opened this issue 8 years ago • 2 comments

Would be great, to expose the current frame. Something like a counter that starts, once the animation is running and increases on every draw call.

Variable name could be i or f.

I'd suggest to start with i=0, so people can use it to initialize globals on the first run.

aemkei avatar Feb 20 '17 08:02 aemkei

you already can use frame from the calling scope. for init you can use t as in t||(x=y=0,othervars=123)

naughton avatar Feb 20 '17 09:02 naughton

I needed an integer frame counter, not time as float, so I did: u.f=++u.f||0 Edit: Oh, I see, frame is in scope. Edit2: And t is not actually the time but frame counter / 60 so it will not be correct if the animation doesn't run at a full 60 fps. https://github.com/lionleaf/dwitter/blob/master/dwitter/templates/dweet/dweet.html#L100

johanberonius avatar Feb 23 '17 18:02 johanberonius