Just Launched! Gyro & Accelerometer Functions

#Just Launched! Gyro & Accelerometer Functions
We’ve added support for watchfaces to use the motion and position of your watch to create awesome new animations for your watchfaces in the Facer Creator.

##New Functions
You can check these all out in the Facer reference doc, but these are the main functions we’ve added:

  • accelerometerX() - Outputs the X axis of the accelerometer sensor, accumulated into positional coordinates
  • accelerometerY() - Outputs the Y axis of the accelerometer sensor, accumulated into positional coordinates

For those that want to dig deeper, we’ve also included:

  • gyroX() - Outputs the X axis of the gyro sensor, accumulated into positional coordinates
  • gyroY() - Outputs the Y axis of the gyro sensor, accumulated into positional coordinates
  • gyroRawX() - Outputs the raw X axis of the gyro sensor, which detects rotational acceleration
  • gyroRawY() - Outputs the raw Y axis of the gyro sensor, which detects rotational acceleration
  • accelerometerRawX() - Outputs the raw X axis of the accelerometer sensor
  • accelerometerRawY() - Outputs the raw Y axis of the accelerometer sensor

Example Watchface using Accelerometer

Assuming you needed to make a watchface based on a taco that can’t stay together in motion (because of course you do), here’s a perfect example:

Note - the original watchface is here, but you won’t see the motion on your desktop! Make sure you use the incredibly awesome ‘Send to My Watch’ feature to try it out on your watch!

This example uses a couple of layers with the accelerometer functions to let the taco ingredients move with the watch.

For example, the ‘lettuce’ layer has the following equation for X:

(clamp((160+(accelerometerX()*50)),140,180))

Let’s look at accelerometerX() first. In this case, I multiply it by 50 so the movement is fairly quick.

Around that, I use clamp to keep the values within the watchface screen, and where I want it (between 140 and 180 on the watch screen), and then the accelerometerX(), multiplied by 50 so it moves quickly. (The ‘160+’ at the beginning of the clamp is just my center point for the X value)

The taco shell itself has a slightly different variation of this same equation to give it the ‘parallax’ effect:

(clamp((160+(accelerometerX()*-5)),150,170))

Notice I multiply accelerometerX by -5, so it slides slowly in the opposite direction. I also ‘clamp’ it between 150 and 170 so it doesn’t move quite as far as the other elements.

Don’t forget to use Send to my Watch as you work on these so you can preview the real motion!


Please make a cooler watchface.

Now that you know about the Accelerometer functions, we hope you can make something that’s even better than a shaky taco! Hop into the editor today to get started!

Note from the editor: We apologize, we have no idea why our Director of Product insists on making taco-based watchfaces.

1 Like

This is very cool functionality, thanks for the detailed walkthrough!

Unfortunately, I’m having some trouble using these new functions with my Huawei Watch. I created a demo face that just outputs gyroX as text - a text string with value (gyroX()) - and when the face appears, the value starts at 0.01 and increases in value by around 0.1-0.15 per second until the face dims, regardless of watch movement or orientation. Outputting gyroRawX() just shows 0, though accelerometerRawX() returns values that look right. I also tried the (adorable) taco watchface and it seems to be slightly more accurate.

I’ve read that other folks have had trouble with the Huawei Watch gyroscope, so this might not be related to the Facer implementation, but any idea what could be wrong? Happy to provide any other debugging info that could be useful!

@samuelf I too, have been toying with these functions on a Huawei Watch and I also had them readout as lines of text with the same results. Could it be the sensitivity of the gyro and accelerometer of the watch? Even sitting flat on my desktop the accelerometerRawX fluctuates rapidly in a ±0.05 range.

@samuelf @apalileo Facer Dev here, just wanted to pop in and say thanks for the feedback!

First off, it does look like there might be an issue with gyroRawX() on some devices, so we’ll look into a fix for that one.

As for the gyroX/Y methods (and their accelerometer counterparts), some “drift” in the values is expected. To keep things really high level, the gyroX/Y position is an approximation at best, and is based on acceleration snapshots we get from the sensors (the “raw” methods return just those snapshots, by the way). The sensors are rather precise, and there’s some degree of missing information between snapshots, so we try to get as close as we can to reality. Occassionally, especially with very small movements, things won’t match up exactly, which is why you might see the numbers drift in one direction or another when you would otherwise be motionless.

The other thing to keep in mind is that these values can include acceleration due to gravity, so if your desk is not perfectly level – and I do mean perfectly – gravity will probably pull the acceleration in one direction or another at a very small rate while it’s sitting there.

We try to smooth these values out as best we can, but there’s no perfect solution as of yet, especially before we have seen how the community uses these methods. For the moment, the plan is to keep an eye on how they’re being used until we’re sure that any change we make will be beneficial.

Thanks again for taking the time to let us know how the feature is working for you, it’s a great help to us. We’ll definitely be keeping an eye on this kind of feedback as we consider any changes we might make.

2 Likes

Very noob to this, but thought my new BADTAT face could benefit from the realism ogf a gyro controlled shadow top layer. Except I need the gyro direction to be inverted? Do you get what I mean? If I tilt left, need to move the shadow to the right. Also, I literally just copied and pasted the first taco formula and noticed the shadow has a lag. Is it my Huawei? Thanks in advance! Trying to get this gyro thing down!

@randvmb I think you could just multiply the equation by -1 (haven’t tested this, but it would be my first try!). Outside of that, I’ll check out shadows and see what’s what there - thanks for letting us know!