# How can I create a countdown timer in Cycles?

I'd like to create a countdown timer, something like this, using cycles:

I have found a pretty straightforward video about the problem (https://www.youtube.com/watch?v=5fClNkcP0KA), and it works just fine, but couldn't solve the problem of viewing the output of the script in the cycles renderer. I'd like to create a video of it, so probably I should somehow provide a framerate for the script as well, but don't have any idea how to start. Thanks!

• BGE != cycles. Scripts for one will not work in the other. Sep 2 '17 at 9:17
• I was afraid to hear as well. Then is there any way to solve this for cycles? Sep 2 '17 at 9:21

Please have a try with this script By Respected fellow: batFINGER:

import bpy
import math
from bpy.props import BoolProperty
def countdown_timer(scene):
# look for all font objects with _timer property
timers = [ob.data for ob in scene.objects if ob.type == 'FONT' and ob.data.is_timer]
for font in timers:
secs = font["timer"]
countdown_frames = secs * scene.render.fps / scene.render.fps_base
frame = countdown_frames - scene.frame_current + 1
if frame < 0:
continue
t = float(frame * scene.render.fps_base ) / float(scene.render.fps)
minutes = t // 60
t %= 60
seconds = math.floor(t)
t = t - seconds
hundreds = math.floor(100 * (t))
font.body = "%02d:%02d:%02d" % (minutes,seconds,hundreds)
return None
def is_timer(self, context):
if self.is_timer:
if "timer" not in self.keys():
self["timer"] = 10 # 10 seconds default
return None
class TimerPanel(bpy.types.Panel):
"""Timer Panel"""
bl_label = "Countdown Timer"
bl_idname = "FONT_PT_timer"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "data"

@classmethod
def poll(cls, context):
return (context.object and context.object.type in {'FONT'} and context.curve)
font = context.object.data

self.layout.prop(font, "is_timer", text="")
def draw(self, context):
font = context.object.data
layout = self.layout
if font.is_timer:
row = layout.row()
row.prop(font,'["timer"]', text="Seconds")
def register():
bpy.types.TextCurve.is_timer = BoolProperty(default=False, update=is_timer, description="Make countdown timer")

bpy.app.handlers.frame_change_pre.append(countdown_timer)
bpy.utils.register_class(TimerPanel)

def unregister():
bpy.utils.unregister_class(TimerPanel)
bpy.app.handlers.frame_change_pre.pop()

if __name__ == "__main__":
register()


Copy it to the Text Editor

Dont forget to hit run script

Create a new text and you will get a new option box under fonts.

Adjust the value as per your needs

Play it! It can be used in Cycles or gaming engine !

You will have a full control of materials fonts size and rotations etc

Best of luck

• Good abswer, but please use proper code tags for formatting your answer from the toolbar, otherwise it will display wrongly Sep 2 '17 at 11:36
• Thank you for your guide line, I tried to update it as per code but not looking good, can you please update it for me or guide me for the steps Sep 2 '17 at 12:10
• While editing your post there are buttons in the toolbar on top for this purpose Sep 2 '17 at 12:28
• @DuarteFarrajotaRamos , yeah gotta agree good answer... Wait a minute it Looks Familiar ... commented about it recently worth an UV lol. Sep 2 '17 at 18:16
• Hey that is cheating! Copy pasting someone else's code without giving credit for your own profit is bad. Too bad one can't retract vote now :( Sep 3 '17 at 0:18

Another way to do it is with Animation Nodes.