# How to change the fill color dynamically on the basis of  the duration of press when pressed the button 

**URL:** <https://forums.fusetools.com/t/how-to-change-the-fill-color-dynamically-on-the-basis-of-the-duration-of-press-when-pressed-the-button/2066>\
**Category:** How-to Discussions\
**Created:** [July 11, 2016, 3:17am UTC](https://forums.fusetools.com/t/how-to-change-the-fill-color-dynamically-on-the-basis-of-the-duration-of-press-when-pressed-the-button/2066 "2016-07-11T03:17:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Huhu](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/huhu/32/403_2.png) [@Huhu](https://forums.fusetools.com/u/Huhu)\
**Post date:** [July 11, 2016, 3:17am UTC](https://forums.fusetools.com/t/how-to-change-the-fill-color-dynamically-on-the-basis-of-the-duration-of-press-when-pressed-the-button/2066/1 "2016-07-11T03:17:33Z")

</div>

I want to change the fill color dynamically on the basis of time duration of press when pressed the button.

Just like the follow:

When the time of duration is 1s , the fill color is #ffffff;

When the time of duration is 1.1s , the fille color is #ffff00;

When the time of duration is 1.2s , the fille color is #ffff11;

…

Or

The fill color brightness from brightness to dark dynamically as the time of pressed duration;

PLS help me, Thanks!

---

<div class="post-metadata">

**Author:** ![petterroea](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/petterroea/32/438_2.png) [@petterroea](https://forums.fusetools.com/u/petterroea)\
**Post date:** [July 11, 2016, 9:16am UTC](https://forums.fusetools.com/t/how-to-change-the-fill-color-dynamically-on-the-basis-of-the-duration-of-press-when-pressed-the-button/2066/2 "2016-07-11T09:16:48Z")

</div>

Hey;

Is this what you are looking for?

```auto
<App>
  <Panel>
    <Rectangle Color="#4CAF50" ux:Name="colorRect"/>
    <WhilePressed>
      <Change colorRect.Color="#1B5E20" Duration="5" />
    </WhilePressed>
  </Panel>
</App>

```

---

<div class="post-metadata">

**Author:** ![Huhu](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/huhu/32/403_2.png) [@Huhu](https://forums.fusetools.com/u/Huhu)\
**Post date:** [July 12, 2016, 1:51pm UTC](https://forums.fusetools.com/t/how-to-change-the-fill-color-dynamically-on-the-basis-of-the-duration-of-press-when-pressed-the-button/2066/3 "2016-07-12T13:51:24Z")

</div>

That is it, thanks!
