A comprehensive guide to code a multi-screen watch face with animated fading transitions and changeable colors in Watchmaker for non coders
This guide will walk you trough coding a 3 screens watch face with 4 changeable colors.
Page 1
By Frank Dufaux
To Begin The Main Script. This is the complete main script that will drive the watch face it is color coded in 4 sections. Starting at the page 3 we will go trough each sections of the script and explain in detail what they are and what they do. var_changescreen= 1 var_clrnum= 1 var_color={'0000ff','00ff00','ff0000','00ffff'} tweens.screen1= 100 tweens.screen2= 0 tweens.screen3= 0 function setclr() if var_clrnum== 4 then var_clrnum=1 else var_clrnum=var_clrnum+1 end end function chscreen() if var_changescreen== 3 then var_changescreen= 1 else var_changescreen= var_changescreen +1 end end function screenfades() if var_changescreen==1 then wm_schedule { action='tween', tween='screen3', from=100, to=0, duration=0.5, easing=linear } wm_schedule { action='tween', tween='screen1', from=0, to=100, duration=0.5, easing=linear } end if var_changescreen==2 then wm_schedule { action='tween', tween='screen1', from=100, to=0, duration=0.5, easing=linear } wm_schedule { action='tween', tween='screen2', from=0, to=100, duration=0.5, easing=linear } end if var_changescreen==3 then wm_schedule { action='tween', tween='screen2', from=100, to=0, duration=0.5, easing=linear } wm_schedule { action='tween', tween='screen3', from=0, to=100, duration=0.5, easing=linear } end end
Page 2
By Frank Dufaux
Main Script Section 1 The Variables (var) and the Tweens var_changescreen= 1 var_clrnum= 1 var_color={'0000ff','00ff00','ff0000','00ffff'} tweens.screen1= 100 tweens.screen2= 0 tweens.screen3= 0 Variables are defining the state of different element like color, rotation etc... anything you want to control trough code. The tweens are a type of variables that define the state of an animation for any elements you want to animate. var_changescreen= 1 (this is the initial state of the screen change. The var_ part is a default use to define a variable the changescreen part is compose by you and can be anything logically related to what you want to do, the = 1 part is the screen number that will be loaded by default for that variable when the watch is loaded.) var_clrnum=1 (this is the variable initial state for the color selection. The var_ part is a default use to define a variable the clrnum part is compose by you and can be anything logically related to what you want to do, the = 1 part is the color that will be loaded by default for that variable when the watch is loaded.) var_color={'0000ff','00ff00','ff0000','00ffff'} (this is the variable where you define the array-list of colors you want. The var_ part is a default use to define a variable the color part is compose by you and can be anything logically related to what you want to do, the ={'0000ff','00ff00','ff0000','00ffff'} part is the array list you create to define the colors you want the user to access.) tweens.screen1= 100 (this is the animation initial variable value for the opacity amount of screen 1. the tweens. part is a default use to define a animation variable, the screen1 part is compose by you logically related to what you want to animate, the = 100 the opacity level applied at the watch face loading.) tweens.screen2= 0 (this is the animation initial variable value for the opacity amount of screen 2. the tweens. part is a default use to define a animation variable, the screen2 part is compose by you logically related to what you want to animate, the = 0 the opacity level applied at the watch face loading.) tweens.screen3= 0 (this is the animation initial variable value for the opacity amount of screen 3. the tweens. part is a default use to define a animation variable, the screen3 part is compose by you logically related to what you want to animate, the = 0 the opacity level applied at the watch face loading.) Page 3
By Frank Dufaux
Main Script Section 2 The Color Change Function. function setclr() if var_clrnum== 4 then var_clrnum=1 else var_clrnum=var_clrnum+1 end end
Page 4
By Frank Dufaux