ApplicationImpl cleanup, part 1:
[chromium-blink-merge.git] / third_party / polymer / v1_0 / components-chromium / neon-animation / neon-shared-element-animation-behavior-extracted.js
blob28f7617aaf822f63ce1fd4ff2e1c3e2514e4bd67
3 /**
4 * Use `Polymer.NeonSharedElementAnimationBehavior` to implement shared element animations.
5 * @polymerBehavior Polymer.NeonSharedElementAnimationBehavior
6 */
7 Polymer.NeonSharedElementAnimationBehaviorImpl = {
9 properties: {
11 /**
12 * Cached copy of shared elements.
14 sharedElements: {
15 type: Object
20 /**
21 * Finds shared elements based on `config`.
23 findSharedElements: function(config) {
24 var fromPage = config.fromPage;
25 var toPage = config.toPage;
26 if (!fromPage || !toPage) {
27 console.warn(this.is + ':', !fromPage ? 'fromPage' : 'toPage', 'is undefined!');
28 return null;
31 if (!fromPage.sharedElements || !toPage.sharedElements) {
32 console.warn(this.is + ':', 'sharedElements are undefined for', !fromPage.sharedElements ? fromPage : toPage);
33 return null;
36 var from = fromPage.sharedElements[config.id]
37 var to = toPage.sharedElements[config.id];
39 if (!from || !to) {
40 console.warn(this.is + ':', 'sharedElement with id', config.id, 'not found in', !from ? fromPage : toPage);
41 return null;
44 this.sharedElements = {
45 from: from,
46 to: to
48 return this.sharedElements;
53 /** @polymerBehavior Polymer.NeonSharedElementAnimationBehavior */
54 Polymer.NeonSharedElementAnimationBehavior = [
55 Polymer.NeonAnimationBehavior,
56 Polymer.NeonSharedElementAnimationBehaviorImpl