Timer Clock with animating the channel in fonts node

   1790   3   1
User Avatar
Member
3 posts
Joined: Nov. 2021
Offline
Hi there,

I have a running project, where I was wondering if there is an easy way to animate an timer on a bomb through the fonts node?
Any suggestions?

Many thanks,

Attachments:
Houdini_Countdown_Timer - Copy.PNG (1.3 MB)

User Avatar
Member
654 posts
Joined: Aug. 2014
Offline
Of course. One of the possible ways is to use Python expression inside the Text parameter.

For example:
target_seconds = 5
second = target_seconds + 1 - (hou.frame() / hou.fps())
if second > 0:
    return int(second)
else:
    return 0
It must always return some value.

Attachments:
font_countdown.hipnc.tar.gz (12.2 KB)

User Avatar
Member
3 posts
Joined: Nov. 2021
Offline
Thanks for your suggestions! Is there any way to add kind of timecode in the text parameter?




ajz3d
Of course. One of the possible ways is to use Python expression inside the Text parameter.

For example:
target_seconds = 5
second = target_seconds + 1 - (hou.frame() / hou.fps())
if second > 0:
    return int(second)
else:
    return 0
It must always return some value.

Attachments:
timecode - Copy.png (23.8 KB)

User Avatar
Member
654 posts
Joined: Aug. 2014
Offline
Python's time [docs.python.org] module might be a good starting point. And if you don't want to use it, you can accomplish the task with some math and string concatenation. There are a lot of examples on the Internet covering the creation of countdown timers in Python.
  • Quick Links