# How to design and code a Timer in AppLab?

**URL:** <https://forum.code.org/t/how-to-design-and-code-a-timer-in-applab/7452>\
**Category:** CS Principles\
**Created:** [May 31, 2017, 12:58pm UTC](https://forum.code.org/t/how-to-design-and-code-a-timer-in-applab/7452 "2017-05-31T12:58:31Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![baker](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/baker/32/1229_2.png) [@baker](https://forum.code.org/u/baker)\
**Post date:** [June 6, 2017, 4:37am UTC](https://forum.code.org/t/how-to-design-and-code-a-timer-in-applab/7452/6 "2017-06-06T04:37:39Z")

</div>

At the risk of oversimplifying…here’s a super simple example that just uses timedLoop

> **[Check out what I made](https://studio.code.org/projects/applab/-NnPZ-h5ZgIF5FjnVoPsBA/)**
>
> I wrote the code myself with Code.org

  
If you want to make this into a game there’s some (read: quite a bit) more work to do.

Also worth noting: this isn’t an app lab thing. It’s a javascript thing. And synchronizing timers is super hard…maybe impossible. So, the typical pattern / mindset is that you should have one timer (and only one) for animation. Set it to whatever delay you like and then write code to do some incremental step at each “tick” of the timer.

Here is another example that shows some bouncing balls: [https://studio.code.org/projects/applab/U2n8QalI4-I-oYZJ1SMSIg/](https://studio.code.org/projects/applab/U2n8QalI4-I-oYZJ1SMSIg/)  
Notice that there is one timer on a delay of 41ms (~24 frames per second).

---

_[View the full topic](https://forum.code.org/t/how-to-design-and-code-a-timer-in-applab/7452)._
