OLD | NEW |
1 <!-- | 1 <!-- |
2 @license | 2 @license |
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
9 --> | 9 --> |
10 | 10 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 translateY = (fromRect.top + (fromRect.height / 2)) - (toRect.top + (toR
ect.height / 2)); | 63 translateY = (fromRect.top + (fromRect.height / 2)) - (toRect.top + (toR
ect.height / 2)); |
64 } | 64 } |
65 var translate = 'translate(' + translateX + 'px,' + translateY + 'px)'; | 65 var translate = 'translate(' + translateX + 'px,' + translateY + 'px)'; |
66 | 66 |
67 var size = Math.max(toRect.width + Math.abs(translateX) * 2, toRect.height
+ Math.abs(translateY) * 2); | 67 var size = Math.max(toRect.width + Math.abs(translateX) * 2, toRect.height
+ Math.abs(translateY) * 2); |
68 var diameter = Math.sqrt(2 * size * size); | 68 var diameter = Math.sqrt(2 * size * size); |
69 var scaleX = diameter / toRect.width; | 69 var scaleX = diameter / toRect.width; |
70 var scaleY = diameter / toRect.height; | 70 var scaleY = diameter / toRect.height; |
71 var scale = 'scale(' + scaleX + ',' + scaleY + ')'; | 71 var scale = 'scale(' + scaleX + ',' + scaleY + ')'; |
72 | 72 |
73 this.setPrefixedProperty(shared.to, 'transformOrigin', '50% 50%'); | |
74 shared.to.style.borderRadius = '50%'; | |
75 | |
76 this._effect = new KeyframeEffect(shared.to, [ | 73 this._effect = new KeyframeEffect(shared.to, [ |
77 {'transform': translate + ' scale(0)'}, | 74 {'transform': translate + ' scale(0)'}, |
78 {'transform': translate + ' ' + scale} | 75 {'transform': translate + ' ' + scale} |
79 ], this.timingFromConfig(config)); | 76 ], this.timingFromConfig(config)); |
| 77 |
| 78 this.setPrefixedProperty(shared.to, 'transformOrigin', '50% 50%'); |
| 79 shared.to.style.borderRadius = '50%'; |
| 80 |
80 return this._effect; | 81 return this._effect; |
81 }, | 82 }, |
82 | 83 |
83 complete: function() { | 84 complete: function() { |
84 if (this.sharedElements) { | 85 if (this.sharedElements) { |
85 this.setPrefixedProperty(this.sharedElements.to, 'transformOrigin', ''); | 86 this.setPrefixedProperty(this.sharedElements.to, 'transformOrigin', ''); |
86 this.sharedElements.to.style.borderRadius = ''; | 87 this.sharedElements.to.style.borderRadius = ''; |
87 } | 88 } |
88 } | 89 } |
89 | 90 |
90 }); | 91 }); |
91 | 92 |
92 </script> | 93 </script> |
OLD | NEW |