I have a Gtk::Label in my application that I use to display notifications.
Each time the text is set I would like to 'blink' it. I find CSS animations
to be the perfect solution for this  since my application deals with
multiple themes with dark mode. I am able to blink the label with the
following CSS code.
.blink
{
  animation-name: blinkEntry;
  animation-duration: 0.25s;
  animation-iteration-count: 1;
  animation-fill-mode: none;
}

@keyframe blinkEntry
{
  0%{ background-color: white;}
  100%{background-color: @app-bg-color;}
}
Now what I am not able to figure out is how to trigger this on an event. In
the handler that sets the text of the label, I add following line.
m_oLabelGuidance.get_style_context()->add_class("blinking");
But as I guessed the label would blink only the first time. I also tried
removing the class before adding again but since it was just one line above
it didn't work. The Gtk::StyleContext::Invalidate was my next best hope but
its already deprecated.

What I saw in some javascript examples is that the animation style class is
removed first and then added back using a timer that is set to trigger
something like 100 milliseconds later.

Would appreciate any guidance.

Regards,
Mohith

-- 


-- 
*Please consider the Environment before printing this e-mail.*




        
        
        
        
The information contained in this message 
(including any attachments) is 
confidential and may be privileged or 
otherwise protected from disclosure. 
 If you are not the intended 
recipient, you must not copy this message or 
attachment or disclose the 
contents to any other person.  If you have 
received this transmission in
 error, please notify the sender immediately 
by return e-mail and 
permanently delete this message and any attachments 
from your system.  
Any dissemination, use, review, distribution, printing 
or copying of 
this message in whole or in part is strictly prohibited.  
Please note 
that e-mails are susceptible to change. 
 
*SKANRAY* 
<http://www.skanray.com>*(including
 its group of companies) shall not be 
liable for any omission or error 
in the message, improper or incomplete 
transmission of the information 
contained in this communication or for any 
delay in its receipt or 
damage to your system. * *SKANRAY* 
<http://www.skanray.com>*(or
 its group of companies) does not guarantee 
that the integrity of this 
communication has been maintained or that this 
communication is free of 
viruses, interceptions or interference.*
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to