This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Michell Tateoka
Posted Sep 09 - Read on Facebook

Hi guys,

I'm trying to make a conditional using dynamic text and am obviously not formatting it correctly. Could someone please help me out?

It's a countdown timer and when the number gets to 0 I want something else to happen.

I'm using template, so I was thinking it would be something like the below (Which doesnt work at all haha). The template name is 't' and is sitting in a design text layer that is targetable and called 'countDown'

if countDown.template.t = 0

# do something here

If you could help me understand the correct syntax for the if statement using a template I would be very appreciative!

4 Comments

Ian McClure

If countDown.template.t is "0" might work for you.

Text is stored as a string and you are checking it against an int which will always return false.

Michell Tateoka

Here's a code example with my non working conditional :
https://framer.cloud/hGeLR

Michell Tateoka

I know I could do this instead:
CountDown.on Events.AnimationEnd, ->

But I want to be able to define the value of the template exact, what if I want to be able to have a bunch of cats pop up when the number gets to five (rather than waiting for countdown to end)

Ian McClure

Because of how the template works, it doesn't work with on change events—Layer.on "change: ", there is no way that I know of to be able to trigger your event when age hits a value of x.
The only way to do it that I can think of would be to use Utils.interval and during each loop of the interval check for the value that you want, then destroy the interval at the end or reset the number.

Here is what I am talking about:
https://framer.cloud/kBiUJ

Read the entire post on Facebook