# Animation with button press and correct check

**URL:** <https://cl.desmos.com/t/animation-with-button-press-and-correct-check/3456>\
**Category:** Questions\
**Tags:** validation, correctness\
**Created:** [June 7, 2021, 8:37pm UTC](https://cl.desmos.com/t/animation-with-button-press-and-correct-check/3456 "2021-06-07T20:37:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sian\_Sleight](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/sian_sleight/32/1592_2.png) [@Sian\_Sleight](https://cl.desmos.com/u/Sian_Sleight)\
**Post date:** [June 7, 2021, 8:37pm UTC](https://cl.desmos.com/t/animation-with-button-press-and-correct-check/3456/1 "2021-06-07T20:37:17Z")

</div>

I have a fireworks animation set up to go with a button press, and I have the correct check working, so how can I only make the fireworks go off when the answer is correct? Thank you!

number(“a”):b1.timeSincePress\>0  
b1.lastvalue(“correct”)

---

<div class="post-metadata">

**Author:** ![cwinske](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/cwinske/32/3106_2.png) [@cwinske](https://cl.desmos.com/u/cwinske)\
**Post date:** [June 7, 2021, 10:10pm UTC](https://cl.desmos.com/t/animation-with-button-press-and-correct-check/3456/2 "2021-06-07T22:10:20Z")

</div>

You can set the time variable to button.timeSincePress when the answer is correct, and if it’s not, set it to zero. In the graph, make a conditional statement for the fireworks to show when the time is greater than zero. Feel free to share the activity if you have trouble making it work!

Edit: I remembered that I had a few activities that used a similar animation. [Learning Targets 28-29 Review • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/60951877bfa2300674c50926)

---

<div class="post-metadata">

**Author:** ![Sian\_Sleight](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/sian_sleight/32/1592_2.png) [@Sian\_Sleight](https://cl.desmos.com/u/Sian_Sleight)\
**Post date:** [June 9, 2021, 12:21am UTC](https://cl.desmos.com/t/animation-with-button-press-and-correct-check/3456/3 "2021-06-09T00:21:42Z")

</div>

That was excellent, thank you! I was able to use that example to make your fireworks work with an input. I couldn’t get it to work with the other fireworks or with the button press, so I might end up posting a slide after all, but I really appreciate all your help!

---

<div class="post-metadata">

**Author:** ![Sian\_Sleight](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/sian_sleight/32/1592_2.png) [@Sian\_Sleight](https://cl.desmos.com/u/Sian_Sleight)\
**Post date:** [June 9, 2021, 7:11pm UTC](https://cl.desmos.com/t/animation-with-button-press-and-correct-check/3456/4 "2021-06-09T19:11:49Z")

</div>

Yeah, I need help.

> **[Fireworks on Button Press if Correct • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/60c00e9df672e924228fbd2e)**
>
> by Sian Sleight

---

<div class="post-metadata">

**Author:** ![cwinske](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/cwinske/32/3106_2.png) [@cwinske](https://cl.desmos.com/u/cwinske)\
**Post date:** [June 9, 2021, 10:15pm UTC](https://cl.desmos.com/t/animation-with-button-press-and-correct-check/3456/5 "2021-06-09T22:15:59Z")

</div>

I made some changes to the timer variable in the calculator code, and changed the conditionals for the two fireworks colors in the graph and it works!

> **[\[Copy of\] Fireworks on Button Press if Correct • Activity Builder by Desmos](https://teacher.desmos.com/activitybuilder/custom/60c13a5437af816e6463fe1b)**
>
> by Craig Winske

---

<div class="post-metadata">

**Author:** ![Sian\_Sleight](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/sian_sleight/32/1592_2.png) [@Sian\_Sleight](https://cl.desmos.com/u/Sian_Sleight)\
**Post date:** [June 10, 2021, 12:10am UTC](https://cl.desmos.com/t/animation-with-button-press-and-correct-check/3456/6 "2021-06-10T00:10:27Z")

</div>

That’s perfect. Thank you _again_! I can’t tell you how much I appreciate all your help.
