Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / neon-animation / neon-animation-behavior-extracted.js
blob8b8f9dc92a5a8ad1688c1a22ab7811359c2f568e
3   /**
4    * Use `Polymer.NeonAnimationBehavior` to implement an animation.
5    * @polymerBehavior
6    */
7   Polymer.NeonAnimationBehavior = {
9     properties: {
11       /**
12        * Defines the animation timing.
13        */
14       animationTiming: {
15         type: Object,
16         value: function() {
17           return {
18             duration: 500,
19             easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
20             fill: 'both'
21           }
22         }
23       }
25     },
27     registered: function() {
28       new Polymer.IronMeta({type: 'animation', key: this.is, value: this.constructor});
29     },
31     /**
32      * Do any animation configuration here.
33      */
34     // configure: function(config) {
35     // },
37     /**
38      * Returns the animation timing by mixing in properties from `config` to the defaults defined
39      * by the animation.
40      */
41     timingFromConfig: function(config) {
42       if (config.timing) {
43         for (var property in config.timing) {
44           this.animationTiming[property] = config.timing[property];
45         }
46       }
47       return this.animationTiming;
48     },
50     /**
51      * Sets `transform` and `transformOrigin` properties along with the prefixed versions.
52      */
53     setPrefixedProperty: function(node, property, value) {
54       var map = {
55         'transform': ['webkitTransform'],
56         'transformOrigin': ['mozTransformOrigin', 'webkitTransformOrigin']
57       };
58       var prefixes = map[property];
59       for (var prefix, index = 0; prefix = prefixes[index]; index++) {
60         node.style[prefix] = value;
61       }
62       node.style[property] = value;
63     },
65     /**
66      * Called when the animation finishes.
67      */
68     complete: function() {}
70   };