Tags

Java FX clock goes SVG

May 22nd, 2007

A nice looking clock in JavaFX reveals that transforming images in JFX still needs some work. But luckily SVG is rather easy to use, some small change to the script and you get this:

clockhands

Note the second hand in comparision to the others.

The script-change:

var secondHand = Path {stroke: red, fill:new Color(0xDF, 0x0E, 0x08, 0xFF)
transform: bind rotate(t.seconds * 6,255,245)
d:[
MoveTo {x: 250, y: 300},
LineTo {x: 260, y: 300},
LineTo {x: 255, y: 50},
ClosePath {}
]
}FxShaded
Update: I improved this a bit with nicer hands and proper(?) lightning, download the full script FxClock.fx