duck-script.mustache revision 9466688e9d5a5faa85464204338f3da699b200aa
<script type="text/javascript">
YUI().use("dial", function(Y) {
var oneFrameWidth = 300,
framesInSprite = 13;
var dial = new Y.Dial({
min: 0,
max: 10000,
minorStep: 1,
majorStep: 2,
stepsPerRevolution: framesInSprite,
diameter: 150
});
dial.render('#demo');
// Reposition the duck sprite background image
dial.on( "valueChange", function(e){
// Handle values greater than one revolution
var moduloValue = (e.newVal % framesInSprite);
Y.one('#duck').setStyle('backgroundPosition', (moduloValue * -oneFrameWidth) + 'px 0px');
}, '#duck' );
});
</script>