OLD | NEW |
| (Empty) |
1 | |
2 | |
3 /** | |
4 * Use `Polymer.NeonSharedElementAnimationBehavior` to implement shared elemen
t animations. | |
5 * @polymerBehavior | |
6 */ | |
7 Polymer.NeonSharedElementAnimationBehavior = [Polymer.NeonAnimationBehavior, { | |
8 | |
9 properties: { | |
10 | |
11 /** | |
12 * Cached copy of shared elements. | |
13 */ | |
14 sharedElements: { | |
15 type: Object | |
16 } | |
17 | |
18 }, | |
19 | |
20 /** | |
21 * Finds shared elements based on `config`. | |
22 */ | |
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 undef
ined!'); | |
28 return null; | |
29 }; | |
30 | |
31 if (!fromPage.sharedElements || !toPage.sharedElements) { | |
32 console.warn(this.is + ':', 'sharedElements are undefined for', !fromPag
e.sharedElements ? fromPage : toPage); | |
33 return null; | |
34 }; | |
35 | |
36 var from = fromPage.sharedElements[config.id] | |
37 var to = toPage.sharedElements[config.id]; | |
38 | |
39 if (!from || !to) { | |
40 console.warn(this.is + ':', 'sharedElement with id', config.id, 'not fou
nd in', !from ? fromPage : toPage); | |
41 return null; | |
42 } | |
43 | |
44 this.sharedElements = { | |
45 from: from, | |
46 to: to | |
47 }; | |
48 return this.sharedElements; | |
49 } | |
50 | |
51 }]; | |
52 | |
OLD | NEW |