Blinking Element

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
3 posts • Page 1 of 1
jonred
Posts:36
Joined: Mon Mar 06, 2017 10:24 am

Blinking Element

Post by jonred »

HI,

How could i make a "blink" animation based on a bool value?

I have a panel with 3 objectstaht want to animate, and tried to use this code in the panel inizialization where they are:

Code: Select all

void EP_BlinkCB(string dp1, bool newValue)
{
if(newValue==1)
  {
     bool oldValueCerrado=cerrado.visible; 
  bool oldValueAbierto=abierto.visible; 
  bool oldValueIndefinido=indefinido.visible; 
  int blinkTime=500;
  while(newValue)
  {
      cerrado.visible=false;  
      abierto.visible=false;
      indefinido.visible=false;
      delay(0,blinkTime);
       cerrado.visible=true;  
      abierto.visible=true;
      indefinido.visible=true;
      delay(0,blinkTime);
  }
    cerrado.visible=oldValueCerrado;  
      abierto.visible=oldValueAbierto;
      indefinido.visible=oldValueIndefinido;
  } 
 
}
but the function get "stuck" and the blinking never ends. I suppose is because i call it again before it ends.
also, because i use delay, if there are different panels each one blinks at a diferent moment, How could i sonchronize them?
I thought of using dinamic colors but the objects are icons so i need to use the visibiliy property.
¿there is no easy way to make this animation?
Thank you very much

nmnogueira
Posts:125
Joined: Thu May 05, 2011 12:59 pm

Re: Blinking Element

Post by nmnogueira »

You should try to find a way to use a dynamic colour, as using a script will create unnecessary load.
You can use an icon which is transparent in the parts you want to animate, and place an object behind it which uses a dynamic (blinking) colour. Or you can place an object over the icon with the shape you want to animate...

jonred
Posts:36
Joined: Mon Mar 06, 2017 10:24 am

Re: Blinking Element

Post by jonred »

Sorry for repliying so late.

In the end, i used square with a dinamic color, being the colors the same as the background and the transparent color, an put it covering the blinking item. Then i make it visible or invisible depending of the alarm signal and done.

3 posts • Page 1 of 1