wear-oswatchface

WearOS 5 Watch Face Format RadialGradients?


I'm trying to just fill the background of a WearOS 5 Watch Face Format with a RadialGradient:

<PartDraw x="0" y="0" width="450" height="450" pivotX="0.5" pivotY="0.5" alpha="255">
    <Variant mode="AMBIENT" target="alpha" value="0"/>
    <Ellipse x="0" y="0" width="450" height="450">
        <Fill color="#80000040" >
            <RadialGradient centerX="225" centerY="225" radius="225"
                    colors="#ff000040 #ff000010" positions=""/>
        </Fill>
    </Ellipse>
</PartDraw>

However all I seem to get on the WearOS 5 emulator is a solid fill, whereas I am expecting to see a gradient that ramps down from the centre.

Can anyone suggest why this doesn't work?


Solution

  • You need to define positions for your colors

    colors="#ff000040 #ff000010" 
    positions="0 1"
    

    With three colors it will be something like

    colors="#000000 #ffff00 #ffffff" 
    positions="0 0.5 1"
    

    This should resolve your issue :)