Bind Effects

I want to bind the blur effect on an image to a timer. For example, timer starts at 15 seconds

If remaining seconds > 10, set blur to 0.30
Else if remaining seconds > 5, set blur to 0.60
Else if remaining seconds = 0, set blur to 1.00

Is there away to have ELSE IFs in custom script? If not, how do I achieve that?
Not sure how to bind just the blur effect with a custom script because it’s grouped with the other effects.

Thanks

Hi @abijaudi,

You can use conditional triggers on the Countdown trigger “Seconds changed”.

Set multiple trigger/actions like:

  • WHEN (“Seconds changed” AND Seconds>10) THEN set blur to 0.3
  • WHEN (“Seconds changed” AND Seconds<5 AND Seconds>0) THEN set blur to 0.6
  • WHEN (“Seconds changed” AND Seconds=0) THEN set blur to 1.00

Kind regards,

Alex.

2 Likes

Hi @abijaudi,

Another option using only bindings and a custom script converter could be a script like below. Bind the Effects property on your timer seconds value, and this script converter (I changed your values to better see the effect)

var blur = 0;
if (INPUT >= 10)
blur = 0.5
else if (INPUT >= 5 && INPUT < 10)
blur = 2
else if (INPUT > 0 && INPUT < 5)
blur = 3
else if (INPUT == 0)
blur = 4

"<EffectsCollection><Blur Radius=\""+blur+"\" /></EffectsCollection>" 

Tested only on Player for Windows.