Neon-animation用于通过使用Web动画来实现Polymer元素的动画过渡。
通过运行以下命令将其安装在项目目录中,可以在应用程序中使用neon动画。
bower install --save PolymerElements/neon-animation
此命令将把neon-animation的所有相关元素安装在bower_components文件夹下。
例子
以下示例指定在Polymer.js中使用氖动画。创建一个index.html文件,并在其中添加以下代码。
<!doctype html> <html> <head> <title>Polymer Example</title> <script src = "bower_components/webcomponentsjs/webcomponents-lite.js"></script> <link rel = "import" href = "bower_components/polymer/polymer.html"> <link rel = "import" href = "bower_components/paper-styles/demo-pages.html"> <link rel = "import" href = "bower_components/neon-animation/web-animations.html"> </head> <body> <h2>Neon Example</h2> <a href = "bower_components/neon-animation/demo/declarative/index.html">Declarative</a> <br> <a href = "bower_components/neon-animation/demo/dropdown/index.html">Dropdown</a> <br> <a href = "bower_components/neon-animation/demo/grid/index.html">Grid</a> <br> <a href = "bower_components/neon-animation/demo/tiles/index.html">Tiles</a> <br> <a href = "bower_components/neon-animation/demo/card/index.html">Card</a> </body> </html>
输出
要运行该应用程序,请导航到创建的项目目录并运行以下命令。
polymer serve
现在打开浏览器并导航到http://127.0.0.1:8081/。以下将是输出:

作者:terry,如若转载,请注明出处:https://www.web176.com/polymer/2333.html