# Conditional Change

Hi,

Maybe because of being new on Facer I couldn’t find any relevant information in docs on how to conditionnaly change the face.

Let me explain : upon a choosen time stamp, I’d like to change/swap elements in my face watch design.
Is there a way to do this ?

Thanks.

1 Like

You need to think of a time period. Say 8 am to 1 pm. You would apply that conditional to the Opacity Field of the Text or Image layer. Possibly a Progress Bar but not Weather or Sequence. We have to send them off stage.
.
\$#DH#>=8&&#DH#<=13?100:0\$
.
You can work to the minute, second or Date and time but obviously that is more complex.

3 Likes

Tkanks for the information. I guess I need to upgrade to pro plan in order to access such possibility as I don’t see any field allowing me to do that.

Would you be kind enough to provide me a link to this coding as I don’t understand the end part.
I guess 13 is 1 pm but the 100:0 part, I’ve no idea.

EDIT : I should have been more curious… I got the # thing for the parameters so I assume I have to enter this coding string in the field showing the opacity value, i.e 100.
The last question is the syntax of that string for the “13?100:0” part.
13 is 1pm in 24 hours mode. 100:0 is the opacity value to be set but where’s the part for the value 8 o’clock ?

1 Like

You don’ have to update for this!

The formula comes in the opacity field of an object.

The formula: \$#DH#>=8&&#DH#<=13?100:0\$

#DH#>=8 if → If Hour in Day (0-23) >= 8
&& → and
#DH#<=13? → If Hour in Day (0-23) <= 13
100:0 → Then set opacity to 100, when it doesn’t meet the 2 condition it’ blended out.

For your purpose you create 2 objects
the first with opacity 100:0, the second with 0:0

By the way don’t forget the \$ at the begin and end

2 Likes

When the European Cavalry go to bed the American Horses are ready . Nice Tutorial @hippocampus.watches . Interestingly we do not actually need \$ Beginning and end . But I love them as sure and certain reminder that it is not WFS Code as the Tags are Different and they use [ ] instead of ## .
That " If Then Else " is the fundamental building block of any Coding you started at the right place . Mastering that gives you a great springboard for it all . You can look for Inspectable Faces and have a look to see inside . I have . I publish my faces with a the Search Tag Inspectable .
In Creator there is a Lable top right next to My Designs saying COMMUNITY . They are all Inspectable but not that impressive . Just another was to feature the usual suspects .
@parisienne17 you have begun a Fantastic Adventure . Be Aware that you might become Obsessed .

Enjoy .

2 Likes

BTW . || = OR ( Boolean ) . You will use this if your Variables cross Zero .

1 Like

By the way Russel I am as European as You

1 Like

Ha Ha Just stay up later . You will have to excuse me . Memory is one of my problems . Remind me where abouts in Europe ?

1 Like

I live in Germany, having the belgian nationality

1 Like

One of the Sadest things for me , the UK leaving the EU . But enough of that

2 Likes

Thanks for the clarification : because of my eyesight leaving me with 90% blindness I took the 8 for an &. Silly me.

So this code works well but… With a flaw.
Iet’s say I have 2 boxes to display : one between 0-12, hide it & display the other one between 12-24.

In 24h mode, 12 is at 6, no good.
In 12h mode, of course I never get to 13.

I have to test if AM or PM : \$(#DH#>=0&&#DH#<=12)&&#Da#=AM)?100:0\$ doesn’t work.
Alas, I’m no coder.

3 Likes

Uk leaving EU : best being out of a sinking boat.

1 Like

Please, when give us a precise description of what you want, we can give you a precise answer

1 Like

0h > display box1 < 12h then 12h >= hide box1, display box2 <= 24h

1 Like

@parisienne17 There are plenty ways to sort this . We have Visitors so I can only look from a distance . Have a look at #DISDAYTIME# and #Da# gives am/pm . ( from memory ) .

I am not quite sure I understand your Pseudo Code . Perhaps you could try describe it in words or Do a sketch . I often find if I describe what I am trying to achieve Carefully it is a Brief for the project .

Based on a concept with some work to achieve it, I want to dynamically display information : during work hours for instance, display a podometer information box, setting it off display in night hours, showing another box oxygen saturation for exemple.

So I need to have a time period to trigger on or off display.
The issue with \$#DH#>=8&&#DH#<=13?100:0\$ being on for both half of the day, I can’t use it for 8 to 11 am only. it will also be used for 8 to 11pm so I’ve tried testing ((#DH# lower & upper values) and #Da#=AM) but it didn’t worked.

1 Like

This formula will work perfectly between 8 and 11 am

\$#DH#>=8&&#DH#<=11?100:0\$

Did you check to see
that # DISDAYTIME# gives true or false Depending if it is sun risen or sun set .

Let us know what your work Hours are and which days of the Week .

I don’t know what I could have been doing until now, as it is working right now, so big thanks !

Just to push things a little bit, just a tiny bit ;.) is there some kind of Xor, you know the machine instruction allowing inverse display of an object relatively to the background ?

1 Like

Too bad the lack of coding (in which I’m as good as a martian in strawberries farming) will prevent the design of a Ressence smartwatch

1 Like

@parisienne17 . You will be pleased to know we have made Faces like this . but I have to tell you this kind of Project is not for beginners . I think you should spend a bit more time with the Basics . You Graphic Skills would have to equal your Graphical skills to complete a project like that .
Here is a simple example of the Method .
We Presume you know how to inspect work that is Open . On the Web Previews click on the little Rocket on the Left .
.
.

.
.

1 Like