# Help creating simple animation

**URL:** <https://discourse.processing.org/t/help-creating-simple-animation/14089>\
**Category:** Beginners\
**Created:** [September 21, 2019, 12:31am UTC](https://discourse.processing.org/t/help-creating-simple-animation/14089 "2019-09-21T00:31:38Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![unique\_username](https://avatars.discourse-cdn.com/v4/letter/u/a88e57/32.png) [@unique\_username](https://discourse.processing.org/u/unique_username)\
**Post date:** [November 24, 2019, 8:36pm UTC](https://discourse.processing.org/t/help-creating-simple-animation/14089/21 "2019-11-24T20:36:15Z")

</div>

Thanks for letting me know, it’s very helpful.

---

<div class="post-metadata">

**Author:** ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Post date:** [November 24, 2019, 8:37pm UTC](https://discourse.processing.org/t/help-creating-simple-animation/14089/22 "2019-11-24T20:37:58Z")

</div>

Although you could change frameCount at will, it‘s still advised to refrain from doing so. You never know what those internal values might be used for behind the scenes 😅

---

<div class="post-metadata">

**Author:** ![unique\_username](https://avatars.discourse-cdn.com/v4/letter/u/a88e57/32.png) [@unique\_username](https://discourse.processing.org/u/unique_username)\
**Post date:** [November 24, 2019, 8:49pm UTC](https://discourse.processing.org/t/help-creating-simple-animation/14089/23 "2019-11-24T20:49:40Z")

</div>

Using global variables may be better, as then you can make a Timer class, and I don’t believe each class has an individual frameCount(multiple timers running at the same time, but not all starting at the same time)

```auto
class Timer {
    float w;
    float TimerSize;
    float TimerMaxValue;
    color TimerColor;
    float Timerx,Timery;
    Timer(tempTimerSize,tempTimerColor,tempTimerx,tempTimery,tempTimerMaxValue) {
    TimerSize=tempTimerSize;
    TimerColor=tempTimerColor;
    TimerMaxValue=tempTimerMaxValue;
    Timerx=tempTimerx;
    Timery=tempTimery;
    w=0;}
    
    void display() {
    fill(TimerColor);
    textSize(TimerSize);
    text(w,Timerx,Timery);}
    
    void update() {
    w+=0.0152;
    if(tempTimerMaxValue!=null) {
        if(w>=TimerMaxValue) { //greater than or equal to because may be 0.01 over/below max value
        w=0;}
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [November 25, 2019, 1:20am UTC](https://discourse.processing.org/t/help-creating-simple-animation/14089/24 "2019-11-25T01:20:20Z")

</div>

> [@unique\_username](#):
>
> I made my timer with the intent of using it at different times,

> <https://gist.github.com/GoToLoop/ea4db8a8622e27541213da3c9a43ca21>

> <https://gist.github.com/GoToLoop/8017bc38b8c8e0a5b70b>

[Previous page](https://discourse.processing.org/t/help-creating-simple-animation/14089.md?page=1)
