Opacity setting for image to show at night only and fade out during day

Can someone please tell me how to make a moon image fade in when it gets dark and fade back out in the morning?

Try use #DISDAYTIME#.

$#DISDAYTIME#==true?20:100$

1 Like

As an alternative to what @petr.patocka wrote, you could also try this link:

1 Like

Would either of you know how to convert this to watchmaker format? it does not recognise #DISDAYTIME# command
also what do “$” “?” mean?

Sorry I do not know what “watchmaker” format is.

The symbols are used in condititional expressions, see: Conditionals | Facer Documentation

Watchmaker uses Lua

Sorry, I can’t help with anything to do with watchmaker - I’ve never used it and I don’t know how to convert watchmaker like commands/expressions into Facer ones.

The tutorials and guides in the Facer documentation should help you understand how Facer works. Knowing this will make understanding the more advanced features, like time based fading, much easier.

Sorry, not trying to fob you off, I am happy to help, but it will be m\uch easier to help you if you understand the basics first. :slight_smile:

Ill look into doing my project with facer then. Perhaps you could help with this:

How would you go about making an image of a moon appear at night and fade in/out a few hours before and after sunrise/set?

Would you be able to explain some of the variables used.

You could do this using the expression in the link I posted above

The expression that @tara.goisisi came up with is below:

$(#DH#+1)<(#WSH#)&&(#DH#+1)>(#WRH#)?0:$$(#DH#+1)>=(#WSH#)&&(#DH#+1)<=(#WSH#)?((#Dm#)(100/60)):$$(#DH#+1)<=(#WRH#)&&(#DH#+1)>=(#WRH#)?(100-(#Dm#(100/60))):100$

This would be posted into the Transparency field ( in the advanced pop up window ) for your moon layer.

The expression above is a complicated set of nested conditional statements of the form:

If A then W
elseif B then X
elseif C then Y
else Z

or in Facer syntax:

$ A ? W : $$ B ? X : $$ C ? Y : Z $

Because this expression is in the transparency field it evaluates to Transparency being equal to one of W,X,Y or Z

Anything enclosed in # symbols is a tag. You can think of tags as built-in functions that return a text or numeric value. The list of available tags and their descriptions can be found here: Tags | Facer Documentation

&& is a Boolean Operator : Boolean Logic | Facer Documentation

, >=, etc. are operators: Expressions | Facer Documentation

So, in the above, A = (#DH#+1)<(#WSH#)&&(#DH#+1)>(#WRH#)

This reads as

A = ( hour_in_day +1 ) less_than sunset_hour and ( hour_in_day +1 ) greater_than sunrise_hour

which will evaluate to true or false

Since W = 0, the first part of the conditional reads as, if A then set Transparency to zero, if not then keep evaluating the expression…

( note that in Facer, Transparency = 0 means hidden and Transparency = 100 means fully visible )

I hope that helps.

…

Edit: This topic has already been extensively discussed in this tutorial ( and in a much clearer way :slight_smile: ):

1 Like

Tremendously thank you! So far I have just been browsing thru watches seeing which faces can be customised so I can take a gander at the scripts and try to learn what each does and how. I have some good ideas just need to learn how to realise them in code so I really appreciate the quick facer 101.

2 Likes

You are most welcome.

:slight_smile:

How would I go about displaying “In prog.” or “Complete” where it would change visibility when my #ZSC# < #set goal# and then when #ZSC# >= #set goal# it would switch.

I ran this script that defines the goal
var_steps=5000
function setstep()
if var_steps==10000
then
var_steps=5000
else
var_steps=var_steps+2500
end
end

That works fine and I made a tapable layer to switch between the three different goals. How do I calculate and display using my defined variable?

So basically if A=steps and B = goal how would I make this formula in facer:
If A < B then 0 else if A >= B then 100

And use that in the opacity setting for the two different texts and switch the ‘0’ and ‘100’ to alter which is shown. I can’t seem to figure out where I need () vs. ‘’ vs. [] to get it to calculate. Also how would I use this info to display A/B as a percent. Any advice is helpful. I can get it to show “A/B” but not the value (A/B) when trying to convert it to a percent or display a “%” sign I get an error.

I am sorry, using scripts in Facer is way outside my knowledge. As far as I know it is not possible to have a user defined variable or to run scripts. If you have got it even partly working then you are way ahead of me :slight_smile:

The way I would do something similar to what you are asking is …

  1. Decide on a “hard coded” constant for the goal number of steps; let’s say 10,000

  2. Create two layers or sets of layers, one layer/set for in_progress and one layer/set for Complete

  3. For the layer(s) used for in_progress, set transparency to: $#ZSC#<10000?100:0$

  4. For the layer(s) used for Complete, set transparency to: $#ZSC#<10000?0:100$

I hope that helps.

:slight_smile:

Is there a way to create a tag? I have seen watches that have a step goal that switches between 5, 10, and 15k steps and it has a shaded meter bar as well as a % display.

Where do you define what tapping an item does then if there is no script.? Most of my faces that have tap functions are based on them using tags that facer doesn’t know.

You could have a look here: Facer Creator Pro – How can we help?

There are some built in variables that you can increment and decrement when the user taps an area of the screen. The “Pro” features require a subscription to access.

Looks like a lot of what I’d like to do requires “PRO” can you maybe help me with this one:
I’m trying to get an image to ‘beat’ when the watchface is bright and remain visible when dim.

$#ZLP#==false?100:3*(floor(200*(sin(.99*(pi)(*#Ds#))$

I can’t seem to figure out where the brackets () need to go to make it work. I’m adapting from the following formula from Lua for the same effect.

{abright}==false and 100 or 3math.floor(200math.sin(.99*math.pi{ds}))

Mmm, I have not used #ZLP# and I don’t know what values it can take. The documentation uses an example value of “null” and I don’t know how to test for that. Maybe it is a simple as saying #ZLP#==null, I don’t know.

as for the brackets.

you don’t need ones around pi or tags and I would generally place operators between brackets rather than have a closed bracket immediately followed by an open bracket. So, assuming that the expression is otherwise ok, I would write your expression as

$#ZLP#==false?100:3*(floor(200sin(0.99pi*#Ds#)))$

{ by the way don’t you mean "…?0:3*(floor… "? That is, 0 not 100 because transparency 100 means fully visible and not invisible. Counter intuitive I know :slight_smile: }

…

Now having said all that, I would try to achieve what you want in a different way using two layers not one.

For the first one I would use your beat formula "3*(floor(200sin(0.99pi*#Ds#)))"in the transparency field for the layer, make sure visibility is “turned on” for the “bright layer” but turn of visibility in the dim mode by clicking on the eye symbol under the layer’s name on the “bright” and “dim” panels.

And for the second layer I would set the transparency to a fixed value of 100% and do the opposite with the visibility in the “bright”/“dim” panels.

Does that make sense?

Actually the way you laid it out facer understands AND it accomplished the effect I was hoping for so THANK YOU! You were correct. {abright}==false means “Not bright” so for #ZLP# I needed it to be “Not low power” in order for it to work correctly so:
$#ZLP#==true?100:3*(floor(200sin(0.99pi*#Ds#)))$

Yeah. I’m finding Facer is much less efficient in some aspects and a little more practical in others. wish I knew how to take advantage of both… To make a custom battery meter I had to do 20 images and specify the opacity on each instead of being able to run a simple script or adjusting the default meter. I’m having to create LOTs of clone layers to accomplish my effects. My first draft is about done. please check it out and give some feedback.

I’m also having trouble figuring out what the values of #BS# are because I get 1 or 0 and I dunno how to use that for a charging status indicator. I’m used to a true/false or a “charging” “not charging” to base my expression off. thanks again for the help.

1 Like

I like how the face is coming along. The dim mode in particular is very attractive and the steps animation is very cute.

I have not use #BS#.

If its possible values are 1 or 0 then perhaps you could simply test to see if it equals 0 or 1 and set the transparency of you layer depending on the result.

ie.

$#BS#==0? etc.