/**
@license
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at
http://polymer.github.io/LICENSE.txt The complete set of authors may be found at
http://polymer.github.io/AUTHORS.txt The complete set of contributors may be
found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by Google as
part of the polymer project is also subject to an additional IP rights grant
found at http://polymer.github.io/PATENTS.txt
*/
import"../../polymer/polymer-legacy.js";import{Polymer as e}from"../../polymer/lib/legacy/polymer-fn.js";import{NeonSharedElementAnimationBehavior as t}from"../neon-shared-element-animation-behavior.js";e({is:"ripple-animation",behaviors:[t],configure:function(e){var t,r,i=this.findSharedElements(e);if(!i)return null;var s=i.to.getBoundingClientRect();if(e.gesture)t=e.gesture.x-(s.left+s.width/2),r=e.gesture.y-(s.top+s.height/2);else{var o=i.from.getBoundingClientRect();t=o.left+o.width/2-(s.left+s.width/2),r=o.top+o.height/2-(s.top+s.height/2)}var n="translate("+t+"px,"+r+"px)",a=Math.max(s.width+2*Math.abs(t),s.height+2*Math.abs(r)),h=Math.sqrt(2*a*a),f="scale("+h/s.width+","+h/s.height+")";return this._effect=new KeyframeEffect(i.to,[{transform:n+" scale(0)"},{transform:n+" "+f}],this.timingFromConfig(e)),this.setPrefixedProperty(i.to,"transformOrigin","50% 50%"),i.to.style.borderRadius="50%",this._effect},complete:function(){this.sharedElements&&(this.setPrefixedProperty(this.sharedElements.to,"transformOrigin",""),this.sharedElements.to.style.borderRadius="")}});