Park hands coding?

I’m having to relearn how to do things I know how to do in Watchmaker but not in Facer. One at the moment is a “park” function.

I’d like a tap action to park an object that is in rotation (like the hands for instance) to a fixed position. Tap again to return object to its orbit. I’d also like there to be a smooth sweep between point a and b when tapped as opposed to a jump.

I’ve seen this effect on Facer faces but can’t find it discussed here in the forums.

Thanks for any guidance!

2 Likes

I did one doing that by using VAR (premium feature):
example with the Minutes hand which go to 10’ after taping on the center (VAR_1)
rotation: (#DWFMS#+#VAR_1#*(-#DWFMS#+60))

1 Like

Thanks, couple of questions about this… Does it stay fixed at 10’ ? Because on the surface that tag looks like it would assign a new minutes rotation but plus 10min? Also, does it jump between the two positions when tapped or sweep to get there?

I have worked on something like this. Mine rotates all hands aside for a few seconds upon activating the watch (switch to dim and back to see the effect). It does not always look as good as I want, especially when the hands are near the parking spot, so I haven’t used it yet. I don’t have premium, I think that would make it easier.
Is this something you are looking for:

1 Like

This thread may help …

@ThaMattie Kind of like that but I need it to hold it’s position until tapped again. I know I’ll need premium to employ that but I do have a template saved from the Montblanc contest that has VAR available so I can at least test something out if I can get the code right.

@mikeoday Thanks! I’m going to go check this out now.

hmmm, have to admit. I can’t begin to make sense out of that ! I feel like my objective is much more straight forward than what Miguel was looking to do.

Now I have a clearer plan of what I’d like to do… Specifically object is by default parked at 90deg. On tap, object swings to rotational position already in progress and stays in that rotation until tapped again when it returns to park at 90.

so for example. Let’s say a seconds hand is parked at 90, tap… seconds hand swings to the current second and begins DWFSS from there. tap again… seconds hand sweeps back to parked position at 90.

Relatively simple in Watchmaker but code there is divided over three parts, the main script file, the tap action “button”, and the rotation field of the object. Here in Facer it seems the whole thing has to be expressed only in the rotation field of the object. So I’m at a loss how to convert.

still trying to get this happening…

The basic function is working perfectly with this:

$#VAR_1#==1?#DWFSS#:90$

but… the important part I don’t know how to do is the transition between DWFSS and 90. What do I add to the above expression to have it smoothly tweens between the two? I am still far from fluent in Facer expressions!

This is my second hand formula (remove the line breaks when copying):
$#DWE#<1?((7.5/60*360) + ((1 - #DWE#) * (#DWFS# - (7.5/60*360)))):$
$#DWE#>=1&&#DWE#<2?(7.5/60*360):$
$#DWE#>=2&&#DWE#<3?(#DWFS# + ((3 - #DWE#) * ((7.5/60*360) - #DWFS#))):$
$#DWE#>=3?#DWFS#:$

I always use “functional” values in my formula’s, so mine moves to 7.5 second, you would use 15 for 90 degrees.
As you can see, the formula is split in 4 parts based on the number of seconds active:

  • While less than 1, we are rotating towards 7.5 seconds
  • Between 1 and 2, we stay at 7.5 seconds
  • Between 2 and 3, we are rotating back to the actual seconds
  • While greater than 3, we are always showing actual settings

I’m thinking you need more than 1 variable, 1 to indicate you are parked/parking and one that holds the #DWE# value when tapped, so you can base the timings on that value.
you would get something like
$#VAR_1#==1&&#DWE#<(#VAR_2#+1)?((15/60*360) + ((VAR_2 + 1 - #DWE#) * (#DWFS# - (15/60*360)))):$

@ThaMattie. Thanks for taking the time to help! I’ll see if I can adapt this. Seems like it ought to be easier to do something like this! Like a simple tag to accommodate tweening vs jumping. I’ve seen some complicated animations in Facer, but definitely this sort of thing is much more developed in Watchmaker because of the use of Lua script.

Well now that you mention it, maybe these would help:

FUNCTION DEFINITION EXAMPLE EXPRESSION EXAMPLE OUTPUT
interpAccel(current, min, max, accelerationFactor) Creates a ease-in transition with ‘current’ value (interpAccel(#Ds#, 0, 60, 2)) 0.2669444444444445
interpDecel(current, min, max, accelerationFactor) Creates a ease-out transition with ‘current’ value (interpDecel(#Ds#, 0, 60, 2)) 0.9454258487654321
interpAccelDecel(current, min, max) Creates a ease-in-out transition with ‘current’ value (interpAccelDecel(#Ds#, 0, 60)) 0.5261679781214715

hmm, this looks promising. But I don’t know how to implement it. I’ll experiment, but do you know how I would add (interpAccelDecel(#Ds#, 0, 60)) to this $#VAR_1#==1?#DWFSS#:90$ ?

Still stuck on this problem, but I happened to see a face this morning which had a dimensional transition activated by a tap action. Presumably in that face the code was placed in the height/width field. The basic point A and B were probably something like this:

$#VAR_1#==1? 320:0$

But with something added to create a smooth transition between 0 and 320

Whatever that transition code is would seem to be what I’m looking for to get between point A and B in the rotational field.

Can anyone share an example of this code as applied to the height/width of an object?

I’m going to assume it works the same way. Even for those interpAccelDecel functions, you need some var for keeping the start time of the transition, and the transition true/false.

I checked the docs again, and basically you already have your “VAR_2” available:

TAG DEFINITION EXAMPLE OUTPUT
#VAR_1# Value for interactive variable 1 12
#VAR_1_T# Timestamp at which interactive variable 1 was last updated 1550780123

I cannot really test without pro, but does this work for the Second hand (remove the line breaks):
$#VAR_1#==1&&#DNOW#<(#VAR_1_T#+1000)?((15/60*360) + ((#VAR_1_T# + 1000 - #DNOW#) / 1000 * (#DWFSS# - (15/60*360)))):$
$#VAR_1#==1&&#DNOW#>=(#VAR_1_T#+1000)?(15/60*360):$
$#VAR_1#==0&&#DNOW#<(#VAR_1_T#+1000)?(#DWFSS# + ((#VAR_1_T# + 1000 - #DNOW#) / 1000 * ((15/60*360) - #DWFSS#))):$
$#VAR_1#==0&&#DNOW#>=(#VAR_1_T#+1000)?#DWFSS#:$

that does work in the creator yielding smooth transition between points a and b. But on my watch it still jumps. I may as well say that for simplicity I was giving seconds hand as an example but in reality I’m applying this to a moon phase. And in fact when I plug the moonphase code in place of the all the instances of #DWFSS# it works just as is does with the seconds hand, so that’s a success, but likewise, still jumps in the watch. So still a no-go. But very much appreciate your help! Getting closer!

@Rator @GAUSS you guys both use smooth transitions in some faces, anything you care to share to help me solve this problem? Surely it’s simpler than all this.

again, basic goal is to take this:
$#VAR_1#==1?#DWFSS#:90$

but create a smooth transition between points A and B

I struggled to understand interpAccel and related functions until I read this mini-tutorial by @eradicator09

My beating heart face uses those functions for hand wake up when transitioning from dim to active (part of what you are looking for) as well as to implement the beating heart in the centre.
(just ignore the crude graphics for hands and heart used on the face :slight_smile: looks fine to me on a small watch screen, not so good on a larger higher resolution screen.)

1 Like

@mountain_lion Thanks for all this… I feel like the answer is in there. I’m digging. One question I have, all of these examples are using the wake up #DWE# as a trigger. How do I have the Tap action be the trigger? Is there an expression specifically for that?

So I’ve been experimenting with quite a number of variations based on the tutorial/example. If I use DWE as the “Time Format” as it is in those examples. It makes the hand sweep in transition only the first tap. Subsequent taps just jump between A and B. Many of the variations I use still have the functioning effect of jumping between A and B basically ignoring all the additional code but not breaking down completely. Here’s an example:

$#VAR_3#==1?(interpAccel ((#DNOW#+#VAR_3_T#),1,2,0.8) * #DWFSS#):(interpAccel ((#DNOW#+#VAR_3_T#),1,2,0.8) *90)$

which ends up functioning exactly like:

$#VAR_3#==1?#DWFSS#:90$

I think you need to use the interpaccel thingy. Here’s the code that you’re talking about…
$#VAR_1#=1?(10+(interpAccel((#DNOW#-#VAR_1_T#),0,1000,1)*310)):(320-(interpAccel((#DNOW#-#VAR_1_T#),0,1000,1)*310))$