Flip animation for Fitbit
This library allows you create flip animations in Fitbit apps and clockfaces.
Installation
Install the library with npm i fitbit-flip
The installer will ask you if it can copy the library gui files in your resources
folder:
Press Y
and the fitbit-flip.gui
file will be created automatically.
Press N
if you prefer to copy the file manually afterwards (default choice is Yes)
You still need to modify the resources/widgets.gui
file to add the link to fitbit-flip.gui
:
<!-- import fitbit-flip ui file -->
Usage
Use a fitbit-flip
symbol in your index.gui
file:
Import and use the library in your app/index.js
:
;const elem =id: "elem" // id of GUI elementimg_width: 84 //width of image to animate (there will be 2 per element)img_height: 67 //height of image to animate (there will be 2 per element)duration: 1 // time in seconds to complete half animation (optional, if omited - 1 second will be assumed);//assign images to animateelemstartStaticImage = `new_top.png`; // new image to show (first part)elemendImage = `new_bottom.png`; // new image to show (second part)elemstartImage = `old_top.png`; // old image (first part)elemendStaticImage = `old_bottom.png`; // old image (second part)elemduration = 2; // duration (time in seconds to complete half animation) can also be changed if neededelem; // animate
Launch your app and enjoy.
Demo
A demo is available here