Do we have Timer in perspective?

Hi,
I was using timer in Vision, but in the Perspective i can not find it.
Does anybody know the solution?

Thanks.

No there isn't one - but there are ways to do timer functions.
What problem are you trying to solve?

I show pipe and the flow direction with and arrow. Now i want to animate arrow using timer.
If the Pump state is running i want to change arrow color as animation.
"Blue then Green then Blue" and continue as the pump state running. I hope you understand what i want to achieve. If you have another way please share.

A timer would be a bad way to do this as the timing would be done on the gateway and every change of state would require messaging to the client.

Instead use CSS animation.

3 Likes

Hi, i have implemented as advised in the manual, but it changes the color of the background but not the shape. As you can see in the attached images.

image

Show how you have the style set up.

1 Like

You're setting background-color which changes the background color.

Try using fill:

3 Likes

Well, you followed the tutorial exactly, which changes the background color. Try adjusting something like the fill color, or whichever property you need to adjust.

3 Likes

tried this but arrow is not animating...

I'm fairly certain the fill color is overriding the class. Try removing fill property and just use the class.

4 Likes

... and then create a second non-blinking style class.
Then create an expression binding on the classes property to select which class to apply to the object when the controlling property or tag changes.
e.g.,

if({[default]myBool},
	"ArrowBlinking",
	"ArrowSteady"
)
1 Like

That often solves problems with animating colors on SVGs with style classes. I've had similar experiences.

2 Likes

Hi Steve can you share it please?
Thanks

The fix varies depending on how the SVG is built. I back up the element and work off of a copy. I also use undo as I try stuff.

Generally I have to add a "style" property to a section of the SVG. Then I apply a style class to it to see what happens. If it doesn't change anything I systematically delete things from the SVG to see if I can get it to change. If you can get your styles to impact the SVG as you want them to you can then animate it. You often have to use the advanced style sheet because some sections of SVGs will fill with properties like "fill".

My general recommendation is to work off a copy and try stuff.

Hi, First thanks for all your support.
I have achieved the Blinking arrow by adding the style class inside the element and it's working fine.
Use as a second class as "Transistor" advised.

1 Like

You can use a gif like this and if you want other color you can change with inkscape or other software

Just wanted to share an alternate approach to this topic. While using CSS is likely more performant, this method may be useful in certain scenarios.

You can create an expression tag that uses the now() function to generate a clock pulse. This pulse can then be used to drive screen animations or trigger periodic updates in your view.

Expression function setup.

Perspective session custom properties that can be used thought the application to provide the various timer pulses.

1 Like

That is not recommended. The expressions run on the gateway, take up gateway resources (firing up the Jython script interpreter) and generate a traffic between the gateway and the browser. There is also likely to be noticeable jitter on shorter time periods.

1 Like

Thanks for the additional insight. Do you have a source that indicated where the now() function runs? I just want to learn more about where expressions are executed.

The manual makes it seem like the now() expression runs on the client PC.

From the manual
Returns the current time. The host computer's system clock is used, meaning that if this expression is being evaluated in a running client, the computer running the client's system clock is used.