src/cm/media/js/lib/yui/yui_3.10.3/docs/transition/transition-usage.html
changeset 525 89ef5ed3c48b
equal deleted inserted replaced
524:322d0feea350 525:89ef5ed3c48b
       
     1 <!DOCTYPE html>
       
     2 <html lang="en">
       
     3 <head>
       
     4     <meta charset="utf-8">
       
     5     <title>Example: Using Transitions</title>
       
     6     <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic">
       
     7     <link rel="stylesheet" href="../../build/cssgrids/cssgrids-min.css">
       
     8     <link rel="stylesheet" href="../assets/css/main.css">
       
     9     <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
       
    10     <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
       
    11     <script src="../../build/yui/yui-min.js"></script>
       
    12     
       
    13 </head>
       
    14 <body>
       
    15 <!--
       
    16 <a href="https://github.com/yui/yui3"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
       
    17 -->
       
    18 <div id="doc">
       
    19     <div id="hd">
       
    20         <h1><img src="http://yuilibrary.com/img/yui-logo.png"></h1>
       
    21     </div>
       
    22     
       
    23 
       
    24             <h1>Example: Using Transitions</h1>
       
    25     <div class="yui3-g">
       
    26         <div class="yui3-u-3-4">
       
    27             <div id="main">
       
    28                 <div class="content"><link href="../assets/transition/transition.css" rel="stylesheet" type="text/css">
       
    29 <div class="intro">
       
    30     <p>CSS properties can be transitioned with a delay, allowing for the creation of more advanced effects.
       
    31 Click the X to run the animation.</p>
       
    32 </div>
       
    33 
       
    34 <div class="example" style="height:240px;">
       
    35 <div id="demo">
       
    36     <a href="#">x</a>
       
    37 </div>
       
    38 
       
    39 <script type="text/javascript">
       
    40 YUI().use('transition', function(Y) {
       
    41     var node = Y.one('#demo');
       
    42 
       
    43     node.one('a').on('click', function(e) {
       
    44         e.preventDefault();
       
    45         
       
    46         node.transition({
       
    47             duration: 1, // seconds
       
    48             easing: 'ease-out', // CSS syntax
       
    49             height: 0,
       
    50             top: '100px',
       
    51 
       
    52             width: {
       
    53                 delay: 1,
       
    54                 duration: 0.75,
       
    55                 easing: 'ease-in',
       
    56                 value: 0
       
    57             },
       
    58 
       
    59             left: {
       
    60                 delay: 1,
       
    61                 duration: 0.75,
       
    62                 easing: 'ease-in',
       
    63                 value: '150px'
       
    64             },
       
    65 
       
    66             opacity: {
       
    67                 delay: 1.5,
       
    68                 duration: 0.75,
       
    69                 value: 0
       
    70             }
       
    71         }, function() {
       
    72             node.remove(); 
       
    73         });
       
    74     });
       
    75 });
       
    76 
       
    77 </script>
       
    78 </body>
       
    79 </html>
       
    80 
       
    81 </div>
       
    82 
       
    83 <h2>Separate Transition Properties</h2>
       
    84 <p>Each transition property can optionally have its own duration, delay, and/or easing.</p>
       
    85 <p>An optional callback can be passed as the second argument to <code>transition()</code>.  The callback is run after all property transitions have completed.  In this case, we will use it to remove the node from the document.</p>
       
    86 
       
    87 <pre class="code prettyprint">Y.one(&#x27;#demo&#x27;).transition({
       
    88     duration: 1, &#x2F;&#x2F; seconds
       
    89     easing: &#x27;ease-out&#x27;, &#x2F;&#x2F; CSS syntax
       
    90     height: 0,
       
    91     top: &#x27;100px&#x27;,
       
    92 
       
    93     width: {
       
    94         delay: 1,
       
    95         duration: 0.5,
       
    96         easing: &#x27;ease-in&#x27;,
       
    97         value: 0
       
    98     },
       
    99 
       
   100     left: {
       
   101         delay: 1,
       
   102         duration: 0.5,
       
   103         easing: &#x27;ease-in&#x27;,
       
   104         value: &#x27;150px&#x27;
       
   105     },
       
   106 
       
   107     opacity: {
       
   108         delay: 1.5,
       
   109         duration: 0.25,
       
   110         value: 0
       
   111     }
       
   112 }, function() {
       
   113     this.remove();
       
   114 });</pre>
       
   115 
       
   116 
       
   117 <h2>Complete Example Source</h2>
       
   118 <pre class="code prettyprint">&lt;div id=&quot;demo&quot;&gt;
       
   119     &lt;a href=&quot;#&quot;&gt;x&lt;&#x2F;a&gt;
       
   120 &lt;&#x2F;div&gt;
       
   121 
       
   122 &lt;script type=&quot;text&#x2F;javascript&quot;&gt;
       
   123 YUI().use(&#x27;transition&#x27;, function(Y) {
       
   124     var node = Y.one(&#x27;#demo&#x27;);
       
   125 
       
   126     node.one(&#x27;a&#x27;).on(&#x27;click&#x27;, function(e) {
       
   127         e.preventDefault();
       
   128         
       
   129         node.transition({
       
   130             duration: 1, &#x2F;&#x2F; seconds
       
   131             easing: &#x27;ease-out&#x27;, &#x2F;&#x2F; CSS syntax
       
   132             height: 0,
       
   133             top: &#x27;100px&#x27;,
       
   134 
       
   135             width: {
       
   136                 delay: 1,
       
   137                 duration: 0.75,
       
   138                 easing: &#x27;ease-in&#x27;,
       
   139                 value: 0
       
   140             },
       
   141 
       
   142             left: {
       
   143                 delay: 1,
       
   144                 duration: 0.75,
       
   145                 easing: &#x27;ease-in&#x27;,
       
   146                 value: &#x27;150px&#x27;
       
   147             },
       
   148 
       
   149             opacity: {
       
   150                 delay: 1.5,
       
   151                 duration: 0.75,
       
   152                 value: 0
       
   153             }
       
   154         }, function() {
       
   155             node.remove(); 
       
   156         });
       
   157     });
       
   158 });
       
   159 
       
   160 &lt;&#x2F;script&gt;
       
   161 &lt;&#x2F;body&gt;
       
   162 &lt;&#x2F;html&gt;</pre>
       
   163 
       
   164 </div>
       
   165             </div>
       
   166         </div>
       
   167 
       
   168         <div class="yui3-u-1-4">
       
   169             <div class="sidebar">
       
   170                 
       
   171 
       
   172                 
       
   173                     <div class="sidebox">
       
   174                         <div class="hd">
       
   175                             <h2 class="no-toc">Examples</h2>
       
   176                         </div>
       
   177 
       
   178                         <div class="bd">
       
   179                             <ul class="examples">
       
   180                                 
       
   181                                     
       
   182                                         <li data-description="Demonstrates the basic usage of Transitions.">
       
   183                                             <a href="transition-basic.html">Basic Node Transitions</a>
       
   184                                         </li>
       
   185                                     
       
   186                                 
       
   187                                     
       
   188                                         <li data-description="Demonstrates more advanced usage of Transitions.">
       
   189                                             <a href="transition-usage.html">Using Transitions</a>
       
   190                                         </li>
       
   191                                     
       
   192                                 
       
   193                                     
       
   194                                         <li data-description="Demonstrates how to animate Node&#x27;s show and hide methods.">
       
   195                                             <a href="transition-view.html">Showing and Hiding with Transitions</a>
       
   196                                         </li>
       
   197                                     
       
   198                                 
       
   199                                     
       
   200                                 
       
   201                                     
       
   202                                 
       
   203                                     
       
   204                                 
       
   205                                     
       
   206                                 
       
   207                                     
       
   208                                 
       
   209                                     
       
   210                                 
       
   211                                     
       
   212                                 
       
   213                             </ul>
       
   214                         </div>
       
   215                     </div>
       
   216                 
       
   217 
       
   218                 
       
   219                     <div class="sidebox">
       
   220                         <div class="hd">
       
   221                             <h2 class="no-toc">Examples That Use This Component</h2>
       
   222                         </div>
       
   223 
       
   224                         <div class="bd">
       
   225                             <ul class="examples">
       
   226                                 
       
   227                                     
       
   228                                 
       
   229                                     
       
   230                                 
       
   231                                     
       
   232                                 
       
   233                                     
       
   234                                         <li data-description="Shows how to create a panel that animates as it is shown and hidden">
       
   235                                             <a href="../panel/panel-animate.html">Creating an Animated Panel</a>
       
   236                                         </li>
       
   237                                     
       
   238                                 
       
   239                                     
       
   240                                         <li data-description="This example employs AsyncQueue to incrementally construct an application interface; this illustrates the approach you&#x27;d take to allow chunked rendering of the UI in a process-intensive application.">
       
   241                                             <a href="../async-queue/queue-app.html">Building a UI with AsyncQueue</a>
       
   242                                         </li>
       
   243                                     
       
   244                                 
       
   245                                     
       
   246                                         <li data-description="Extend the Promise class to create your own Node plugin that chains transitions">
       
   247                                             <a href="../promise/plugin-example.html">Creating a Node Plugin that chains transitions</a>
       
   248                                         </li>
       
   249                                     
       
   250                                 
       
   251                                     
       
   252                                         <li data-description="Create a reusable JSONPRequest object to poll the YUILibrary.com Gallery web service, fetching info on a random Gallery module.">
       
   253                                             <a href="../jsonp/jsonp-gallery.html">Reusing a JSONPRequest Instance to Poll a Remote Server</a>
       
   254                                         </li>
       
   255                                     
       
   256                                 
       
   257                                     
       
   258                                         <li data-description="NodeList provides Node functionality for manipulating multiple nodes at once.">
       
   259                                             <a href="../node/nodelist.html">Using NodeList - Simple</a>
       
   260                                         </li>
       
   261                                     
       
   262                                 
       
   263                                     
       
   264                                         <li data-description="How to use multiple NodeList features to build a simple game.">
       
   265                                             <a href="../node/ducks.html">Using NodeList - Ducks Game</a>
       
   266                                         </li>
       
   267                                     
       
   268                                 
       
   269                                     
       
   270                                         <li data-description="This example demonstrates how to insert content into a Node.">
       
   271                                             <a href="../node/node-insert.html">Adding Node Content - Burger Builder</a>
       
   272                                         </li>
       
   273                                     
       
   274                                 
       
   275                             </ul>
       
   276                         </div>
       
   277                     </div>
       
   278                 
       
   279             </div>
       
   280         </div>
       
   281     </div>
       
   282 </div>
       
   283 
       
   284 <script src="../assets/vendor/prettify/prettify-min.js"></script>
       
   285 <script>prettyPrint();</script>
       
   286 
       
   287 <script>
       
   288 YUI.Env.Tests = {
       
   289     examples: [],
       
   290     project: '../assets',
       
   291     assets: '../assets/transition',
       
   292     name: 'transition-usage',
       
   293     title: 'Using Transitions',
       
   294     newWindow: '',
       
   295     auto:  false 
       
   296 };
       
   297 YUI.Env.Tests.examples.push('transition-basic');
       
   298 YUI.Env.Tests.examples.push('transition-usage');
       
   299 YUI.Env.Tests.examples.push('transition-view');
       
   300 YUI.Env.Tests.examples.push('panel-animate');
       
   301 YUI.Env.Tests.examples.push('queue-app');
       
   302 YUI.Env.Tests.examples.push('plugin-example');
       
   303 YUI.Env.Tests.examples.push('jsonp-gallery');
       
   304 YUI.Env.Tests.examples.push('nodelist');
       
   305 YUI.Env.Tests.examples.push('ducks');
       
   306 YUI.Env.Tests.examples.push('node-insert');
       
   307 
       
   308 </script>
       
   309 <script src="../assets/yui/test-runner.js"></script>
       
   310 
       
   311 
       
   312 
       
   313 </body>
       
   314 </html>