1N/A -moz-border-radius: 8px;
1N/A -webkit-border-radius: 8px;
1N/A -moz-box-shadow: 0 0 45px #000 inset, 3px 0 6px rgba(0,0,0,0.8);
1N/A -webkit-box-shadow: 0 0 45px #000 inset, 3px 0 6px rgba(0,0,0,0.8);
1N/A border: 4px solid #637073;
1N/A margin: 0.5em 0 0.8em;
1N/A filter: alpha(opacity=30);
1N/Aul.follower{ /* initial positioning of one row of ducks to follow the other during makeDucksSwim() */
1N/A display: inline-block;
1N/A zoom: 1; *display: inline; /* IE < 8: fake inline-block */
1N/A vertical-align: bottom;
1N/A/* the voice bubble of the ducks */
1N/A -moz-border-radius: 4px;
1N/A -webkit-border-radius: 4px;
1N/A background-color: #ffe;
1N/A border: solid 1px #cc8;
1N/A -moz-box-shadow: 2px 2px 2px rgba(0,0,0,0.2);
1N/A -webkit-box-shadow: 2px 2px 2px rgba(0,0,0,0.2);
1N/A.duck-row .squawk .text{
1N/A padding: 0.2em 0.2em;
1N/A.small-squawk-bubble{
1N/A border: solid 1px #cc8;
1N/A -moz-border-radius: 3px;
1N/A -webkit-border-radius: 3px;
1N/A background-color: #ffe;
1N/A <div class='gallery'>
1N/A <ul class="duck-row leader">
1N/A <ul class="duck-row follower">
1N/A <button id="button-reset" class="yui3-button">Reset</button>
1N/A Ducks remaining: <span class="ducks-remain">10</span>
1N/A <input type="checkbox" id="show-attitude"/><label for="show-attitude">Show attitude</label>
1N/AYUI().use('node', 'transition', 'button', function(Y){
1N/A ducksRemain = 10, // value for UI display
1N/A squawkTextIndex = 0, // index in the squawkTextArr to use next
1N/A squawkTextArr = [ // duck comments
1N/A "U fly's down",
1N/A 'Ricochets kill!',
1N/A 'how sporting.',
1N/A "shoe's untied"
1N/A // append in the content of each duck li since it's the same.
1N/A ducks.append('<img src="{{{componentAssets}}}
/images/duck.png"/><div class="squawk"><div class="text">#@&~*Q!</div><div class="small-squawk-bubble"></div></div>');
1N/A // give them all the set-up state class
1N/A // this makes the ducks move from right to left
1N/A // it also makes one row of 5 ducks follow the other, alternating position.
1N/A var makeDucksSwim = function() {
1N/A }, function(){ // when the row finishes its right to left transition...
1N/A // switch the follower and leader positions
1N/A // set the positions for the next makeDucksSwim()
1N/A Y.one('.follower').setStyle('left', '680px');
1N/A Y.one('.leader').setStyle('left', '10px');
1N/A // if there are ducks remaining, make them swim again
1N/A if (ducksRemain > 0) {
1N/A // the 'follower row of ducks moves at the same rate for the same duration'
1N/A makeDucksSwim(); // this initializes the ducks swimming
1N/A // handles a click on a duck
1N/A // also handles the display of duck comments (squawks)
1N/A var duckClick = function(e) {
1N/A // makes the ducks appear to lay back when clicked
1N/A // clicked duck loses the 'set-up' class
1N/A updateDucksRemain(); // update the number of ducks still set up
1N/A squawks =
Y.all('.duck-row .set-up .squawk'); // a NodeList of the squawks of set-up ducks
1N/A // fill voice bubbles with next text string
1N/A Y.all('.duck-row .set-up .squawk .text').setContent(squawkTextArr[squawkTextIndex]);
1N/A // increment the index
1N/A value: '0px', // drop squawks into position from hidden
1N/A duration: 0 // instant position change
1N/A opacity: { // fade out
1N/A // after squawks are faded out,
1N/A // move them to hidden position and set opacity to 1 again
1N/A // this resets all ducks, ducks remaining counters, and row positions
1N/A // make the duck images full height
1N/A // start them swimming
1N/A var reset = function() {
1N/A Y.all('.duck-row li img').setStyle('height', '55px');
1N/A Y.all('.duck-row li').addClass('set-up');
1N/A updateDucksRemain();
1N/A // counts the ducks remaining, and updates the UI counter display
1N/A var updateDucksRemain = function() {
1N/A Y.one('.ducks-remain').setContent(ducksRemain);
1N/A Y.one('#button-reset').on('click', reset);