curve-old.mustache revision 57135c36536a2f81ce818f6a006f002261972244
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich<link href="{{componentAssets}}/anim.css" rel="stylesheet" type="text/css">
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich<div class="intro">
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich <p>This demonstrates how to animate the position of an element along a <code>curve</code>.</p>
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich <p>Click anywhere on the gray box below and the little orange box will move to the click position.</p>
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich<div class="example">
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich{{>curve-source-old}}
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich<h2>Setting up the HTML</h2>
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich<p>First we add some HTML to animate.</p>
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich<div id="demo-stage">
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich <span id="demo"></span>
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich<h2>Creating the Anim Instance</h2>
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich<p>Now we create an instance of <code>Y.Anim</code>, passing it a configuration object that includes the <code>node</code> we wish to animate.</p>
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovichvar node = Y.one('#demo');
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovichvar anim = new Y.Anim({
76438e9b6959cc0bd7e35fb9cf5a11c87a37f744Allen Rabinovich duration: 1.5,
anim.set('to', {
anim.run();
Y.one('#demo-stage').on('click', onClick);