Is an animated countdown with numbers possible?

As mentioned in the title im curious if i can create an animated countdown with numbered text or number icons.

Thanks for your help.

I haven’t tried this myself, but this may work for you.

You can store a custom state of type number in an element. Then in your workflow, perform a ‘Do every x seconds’ to increment the custom state’s value. In your text element, just reference the custom state as dynamic data.

1 Like

Thanks Scott i’ll try it out.

Is there any documentation on this? I can’t seem to figure it out.

Hi njfrlng the documentation is a bit sparse so they might not have gotten around to it yet if it is possible.

I’ll try to create the solution in the shared app https://bubble.io/page?id=forum_app

I’ll reply again if successful.

awesome! goodluck

Check it out at https://bubble.io/page?type=page&name=scott&id=forum_app&tab=tabs-1
I placed the custom states on the group named “Group Count Up/Down” and make sure to check out the workflows. Let me know if it’s not similar to what you are trying to achieve.

Much thanks! figured it out!

Any idea how to incorporate a countdown timer with a date selector?

I’ve added a separate group on your page where I’m trying to figure it out. No luck yet

Can you please explain what the date selector is for? Are you perhaps trying to count down to a date? If yes, what are you trying to count down by: seconds, minutes, hours, days etc?

Did you ever figure this out? I am trying to do the same thing.

Any info on a countdown would be appreciated

I’m not sure if what I’ve done helps, but here goes…

When a user hits a button to start a timer, I’m creating a record. One of those fields is ‘seconds remaining’. On creation I set this to:

(current date/time + 1500 seconds) - current date time : formatted as seconds

That is, it gets the value 1500 (which in seconds = 25 mins).

On creation of the record, I’m also setting a state to be Timer Started = Yes.

There’s then a workflow action that says:

Every 5 seconds (when Timer Started = Yes), update the record and set ‘seconds remaining’ = ‘seconds remaining’ minus 5

There’s also a Text element which simply displays Seconds Remaining.

It’s not perfect (it only updates every 5 seconds and the time remaining is displayed in seconds rather than mins:secs), but it works.

2 Likes

To correct some really stupid things I said above…

  • As the Seconds Remaining field is a number, it is possible to simply enter the number of seconds on creation (rather than calculate from time)
  • On the ‘do every 5 seconds’ action, you can set the number of seconds (e.g. to 1)

There’s probably other stupid stuff I said which will make the process more efficient?!

1 Like

lol! I was really hoping that I could show the time remaining in days:hours:minutes:seconds format…but maybe this is asking too much!

I have a fudge (and I’m only working with mins)…

If my DB field is a Number (seconds remaining) e.g. 1200 (for 20 mins), then my text label says:

Seconds Remaining - 60 / 60 formatted as 1234 (zero decimal places) min Seconds Remaining <- modulo -> 60 secs

The first formula gives the minutes (it’s necessary to minus 60 seconds otherwise it starts at 20 mins 59 secs). The second formula (modulo) gives the ‘remainder’ of something (i.e. seconds left after dividing the total by 60… keeping it as number of seconds, rather than a decimal remainder of minutes when dividing by 60).

It’s imperfect, but works well enough for me. I’m sure you could extrapolate it out for hours, days, etc.

Of course, if there was a Formatted As TIME (hh:mm:ss) function, that would make life easier.

1 Like

More stupidity from me to correct… The -60 secs in the first part of the formula will do some funky rubbish when you get down to zero mins. So, the reality is that I haven’t yet worked out a clean way to achieve this.

1 Like

NB: The below solution causes one workflow API call per second, and is therefore not practical.

I’ve got a solution that works for me that I’d like to share.

I’ve got a quiz popup where I want a timer of 30 seconds counting down to be displayed. I have a user data (date) field called “End time”. When the quiz popup is shown, I also change the “End time” field for Current User to Current date/time + 30 seconds. In the popup is a Timer Group with data type Number and a text box containing Parent Group’s Number.

I created a workflow that executes every 1 second “When quiz popup is visible AND Current User’s End time - Current date/time : formatted as seconds >= 0”. The last bit is important to make sure the timer stops at zero. This workflow element does “(Display Data in Timer Group) Current User’s End Time - Current Date/Time : formatted as seconds.”

This is only a solution for a seconds countdown, but you could display hours or days and add whatever text or formatting you like. I’m not sure if this causes 30 workflow calls, which would make it an impractical solution, I’d welcome any comments on that issue.

1 Like

Hey Richard, could you show me an example of how to do? I want to make a simple countdown timer but I am struggling to build one using workflows.

I’d be happy to, but Emmanuel just confirmed that my solution generated one Workflow API Call for each second it runs, so this is impractical. I’m researching a better solution (using the fact that Bubble displays live data) and I’ll let you know.

2 Likes

Thanks