You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To make a text or any other view to blink, you can attach a interval to it, and toggle the view visibility visible property in each execution:
val text = text("hello", textSize =64.0, alignment =TextAlignment.CENTER).xy(width *0.5, height *0.5)
text.interval(0.3.seconds) {
text.visible =!text.visible
}
You can set an interval with text.timers.interval(...) or with its shortcuts text.interval(...). It will attach a timer to the view, that will be executed at the right speed based on its hierarchy speed property. The timer will only work while the view is attached to the stage, and won't produce any leak if the view is removed from the stage and no references to the view are remaining.
blinking-text.mp4
The video has sound, but github disables it by default. Press the speaker button in the bottom-right part of the video to enable sound
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
To make a text or any other view to blink, you can attach a interval to it, and toggle the view visibility
visible
property in each execution:You can set an interval with
text.timers.interval(...)
or with its shortcutstext.interval(...)
. It will attach a timer to the view, that will be executed at the right speed based on its hierarchyspeed
property. The timer will only work while the view is attached to the stage, and won't produce any leak if the view is removed from the stage and no references to the view are remaining.blinking-text.mp4
Beta Was this translation helpful? Give feedback.
All reactions