Home | History | Annotate | Download | only in doc
      1 <!doctype html>
      2 <!--
      3 @license
      4 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
      5 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
      6 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
      7 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
      8 Code distributed by Google as part of the polymer project is also
      9 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
     10 -->
     11 <html>
     12   <head>
     13     <title>neon-animation demo: basic</title>
     14 
     15     <meta charset="utf-8">
     16     <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     17     <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
     18 
     19     <script src="../../../webcomponentsjs/webcomponents-lite.js"></script>
     20 
     21     <link rel="import" href="my-animatable.html">
     22     <link rel="import" href="my-dialog.html">
     23 
     24   </head>
     25   <style>
     26     my-animatable {
     27       margin-top: 50px;
     28     }
     29   </style>
     30   <body>
     31 
     32     <template is="dom-bind">
     33 
     34       <button on-click="_onCircleButtonClick">toggle circle</button>
     35       <button on-click="_onDialogButtonClick">toggle dialog</button>
     36 
     37       <div style="text-align: center">
     38         <my-dialog>Hello World!</my-dialog>
     39       </div>
     40 
     41       <my-animatable></my-animatable>
     42 
     43     </template>
     44 
     45     <script>
     46 
     47       var scope = document.querySelector('template[is="dom-bind"]');
     48 
     49       scope._onCircleButtonClick = function(event) {
     50         var node = document.querySelector('my-animatable');
     51         if (node) {
     52           node.animate();
     53         }
     54       };
     55 
     56       scope._onDialogButtonClick = function(event) {
     57         var node = document.querySelector('my-dialog');
     58         if (node) {
     59           if (node.opened) {
     60             node.hide();
     61           } else {
     62             node.show();
     63           }
     64         }
     65       };
     66 
     67     </script>
     68 
     69   </body>
     70 </html>
     71