<div id="demo-stage">
    <span id="demo"></span>
</div>

<script type="text/javascript">
YUI().use('anim', function(Y) {
    var anim = new Y.Anim({
        node: '#demo',
        duration: 0.5,
        easing: Y.Easing.elasticOut
    });

    var onClick = function(e) {
        anim.set('to', { xy: [e.pageX, e.pageY] });
        anim.run();
    };
    
    Y.one('#demo-stage').on('click', onClick);

});

</script>
