Polymer教程:Neon Elements

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/。以下将是输出:

Polymer教程:Neon Elements

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

(0)
打赏 支付宝 支付宝 微信 微信
terryterry
上一篇 2021年4月7日 上午11:28
下一篇 2021年4月7日 上午11:35

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注