0

I was testing Timer of famo.us here

http://famo.us/docs/0.2.0/utilities/Timer

I am confused about the after(). Look like it's an internal engine tick of famo.us but how does it translate to second? Because 5000 was about 9 seconds. It doesn't line up with setTimeout at all.

Any help?

HP.
  • 19,226
  • 53
  • 154
  • 253

1 Answers1

0

The function of after and setTimeout are similiar, however setTimeout is time based (milliseconds) where after counts famo.us engine "ticks"

If you're wanting something to happen after a certain amount of time use setTimeout()

If you're wanting to do something that can be done after a few frames (say for example, we want to poll a phone's accelerometer value or something, but not constantly) use after()

An engine cycle can take more than a millisecond, several really, it depends on the complexity of your scene and the performance of the browser/device, so you shouldn't use after() as a measurement of time.

Hope that clears things.

Kraig Walker
  • 812
  • 13
  • 25