#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.