0

这个 plunk 演示了我试图实现的行为

这个笨蛋证明了我的问题。也就是说,各个<li项目不执行它们的cascaded-animation行为。我所做的只是替换我<content-el>在转发器中调用的自定义元素并更改适当的节点定义。

请通过提供动画各个<content-el>节点的工作来回答。

http://plnkr.co/edit/ZzG4lDvl4V32Bod36208?p=preview
<link href="content-el.html" rel="import">
<base href="https://polygit.org/components/">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>
<link href="polymer/polymer.html" rel="import">

<link rel="import" href="app-layout/app-grid/app-grid-style.html">
<link rel="import" href="neon-animation/neon-animation.html">
<link rel="import" href="paper-card/paper-card.html">

<dom-module id="x-app">
    <template>
        <style include="app-grid-style">
            :host {
                display: block;
                --app-grid-columns: 2;
                --app-grid-gutter: 10px;
                --paper-icon-button-ink-color: white;
            }
            .item {
                height: 250px;
                position: relative;
                background-color: white;
                background-size: cover;
                background-position: center center;
            }
        </style>

        <button on-tap="play">Play Animation</button>
        <div class="centered-container">
            <ul class="app-grid">
                <template id="items"
                                    is="dom-repeat"
                                    items="[1,2,3,4,5,6]"
                                    >
                    <li class="item"
                            style="background-image: url(http://fakeimg.pl/800x800/0079D8/fff/?text=[[item]]);"
                            >
                    </li>
                </template>
            </ul>
        </div>
    </template>

  <script>
    (function() {
      'use strict';
      Polymer({
        is: 'x-app',

                behaviors: [
                    Polymer.NeonAnimationRunnerBehavior,
                ],

                properties: {
                    animationConfig: {
                        type: Object,
                        value: function() {
                            return {
                                'entry': [
                                    {
                                        name: 'slide-from-right-animation',
                                        node: this,
                                    }, {
                                        name: 'cascaded-animation',
                                        animation: 'scale-up-animation',
                                        timing: {
                                            delay: 500,
                                        },
                                    },
                                ],
                            };
                        },
                    },

                },

                attached: function() {
                    this.async(function() {
                        var nodeList = Polymer.dom(this.root).querySelectorAll('li.item');
                        this.animationConfig['entry'][1].nodes = Array.prototype.slice.call(nodeList);
                        //console.log(this.animationConfig['entry'][1].nodes);
                        this.playAnimation('entry');
                    }.bind(this), 500); // https://github.com/Polymer/polymer/issues/2500
                },

                play: function() {
                    this.playAnimation('entry');
                },

            });
        })();
  </script>
</dom-module>
4

1 回答 1

1
<dom-module id="content-el">
<template>
    <style>
       :host {
            box-sizing: border-box;
            display: block;
       }        
    </style>

http://plnkr.co/edit/2bijfuGjC7NjIAPhMIj4?p=preview

于 2016-10-11T06:53:58.950 回答