| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 translateY = (toRect.top + (toRect.height / 2)) - (fromRect.top + (fromR
ect.height / 2)); | 59 translateY = (toRect.top + (toRect.height / 2)) - (fromRect.top + (fromR
ect.height / 2)); |
| 60 } | 60 } |
| 61 var translate = 'translate(' + translateX + 'px,' + translateY + 'px)'; | 61 var translate = 'translate(' + translateX + 'px,' + translateY + 'px)'; |
| 62 | 62 |
| 63 var size = Math.max(fromRect.width + Math.abs(translateX) * 2, fromRect.he
ight + Math.abs(translateY) * 2); | 63 var size = Math.max(fromRect.width + Math.abs(translateX) * 2, fromRect.he
ight + Math.abs(translateY) * 2); |
| 64 var diameter = Math.sqrt(2 * size * size); | 64 var diameter = Math.sqrt(2 * size * size); |
| 65 var scaleX = diameter / fromRect.width; | 65 var scaleX = diameter / fromRect.width; |
| 66 var scaleY = diameter / fromRect.height; | 66 var scaleY = diameter / fromRect.height; |
| 67 var scale = 'scale(' + scaleX + ',' + scaleY + ')'; | 67 var scale = 'scale(' + scaleX + ',' + scaleY + ')'; |
| 68 | 68 |
| 69 this.setPrefixedProperty(shared.from, 'transformOrigin', '50% 50%'); | |
| 70 shared.from.style.borderRadius = '50%'; | |
| 71 | |
| 72 this._effect = new KeyframeEffect(shared.from, [ | 69 this._effect = new KeyframeEffect(shared.from, [ |
| 73 {'transform': translate + ' ' + scale}, | 70 {'transform': translate + ' ' + scale}, |
| 74 {'transform': translate + ' scale(0)'} | 71 {'transform': translate + ' scale(0)'} |
| 75 ], this.timingFromConfig(config)); | 72 ], this.timingFromConfig(config)); |
| 73 |
| 74 this.setPrefixedProperty(shared.from, 'transformOrigin', '50% 50%'); |
| 75 shared.from.style.borderRadius = '50%'; |
| 76 |
| 76 return this._effect; | 77 return this._effect; |
| 77 }, | 78 }, |
| 78 | 79 |
| 79 complete: function() { | 80 complete: function() { |
| 80 if (this.sharedElements) { | 81 if (this.sharedElements) { |
| 81 this.setPrefixedProperty(this.sharedElements.from, 'transformOrigin', ''
); | 82 this.setPrefixedProperty(this.sharedElements.from, 'transformOrigin', ''
); |
| 82 this.sharedElements.from.style.borderRadius = ''; | 83 this.sharedElements.from.style.borderRadius = ''; |
| 83 } | 84 } |
| 84 } | 85 } |
| 85 }); | 86 }); |
| 86 </script> | 87 </script> |
| OLD | NEW |