# Timer Function in Perspective

**URL:** <https://forum.inductiveautomation.com/t/timer-function-in-perspective/91511>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 6, 2024, 7:36pm UTC](https://forum.inductiveautomation.com/t/timer-function-in-perspective/91511 "2024-06-06T19:36:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Peter\_Frazier](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Peter\_Frazier](https://forum.inductiveautomation.com/u/Peter_Frazier)\
**Post date:** [June 6, 2024, 7:36pm UTC](https://forum.inductiveautomation.com/t/timer-function-in-perspective/91511/1 "2024-06-06T19:36:45Z")

</div>

When a tag value changes, I need an image component to become visible. After five seconds, I need it to turn off. Please help!

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [June 6, 2024, 7:58pm UTC](https://forum.inductiveautomation.com/t/timer-function-in-perspective/91511/2 "2024-06-06T19:58:29Z")

</div>

In the view custom properties of the view containing that image component, create a custom prop for the tag value (with binding to the tag), and another for the most recent change timestamp. In a change script attached to the custom prop for the tag value, make this assignment:

```python
self.view.custom.tagChangedTS = system.date.now()

```

On the image component, bind to `props.visible` with this expression:

```python
now(500) < addSeconds({view.custom.tagChangedTS}, 5)

```

If you are using my Integration Toolkit, and want the expression to use no CPU time when inactive, use this variation:

```python
transform(
	asList(
		now(0),
		addSeconds({view.custom.tagChangedTS}, 5)
	),
	transform(
		value()[0] < value()[1],
		asList(
			value(), // The real return boolean value
			now(if(value(), 250, 0)) // Trick to make the expression poll when true
		)[0]
	)
)

```

( I hate leaving polling functions running uselessly, but I want them to run quickly when needed. )
