2024-12-13 14:06:24 -05:00
|
|
|
(t=>{"function"==typeof define&&define.amd?define(["jquery","../version","../effect"],t):t(jQuery)})(function(l){return l.effects.define("size",function(i,e){var f,o=l(this),t=["fontSize"],s=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],n=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],r=i.mode,h="effect"!==r,c=i.scale||"both",d=i.origin||["middle","center"],a=o.css("position"),g=o.position(),m=l.effects.scaledDimensions(o),u=i.from||m,y=i.to||l.effects.scaledDimensions(o,0);l.effects.createPlaceholder(o),"show"===r&&(r=u,u=y,y=r),f={from:{y:u.height/m.height,x:u.width/m.width},to:{y:y.height/m.height,x:y.width/m.width}},"box"!==c&&"both"!==c||(f.from.y!==f.to.y&&(u=l.effects.setTransition(o,s,f.from.y,u),y=l.effects.setTransition(o,s,f.to.y,y)),f.from.x!==f.to.x&&(u=l.effects.setTransition(o,n,f.from.x,u),y=l.effects.setTransition(o,n,f.to.x,y))),"content"!==c&&"both"!==c||f.from.y!==f.to.y&&(u=l.effects.setTransition(o,t,f.from.y,u),y=l.effects.setTransition(o,t,f.to.y,y)),d&&(r=l.effects.getBaseline(d,m),u.top=(m.outerHeight-u.outerHeight)*r.y+g.top,u.left=(m.outerWidth-u.outerWidth)*r.x+g.left,y.top=(m.outerHeight-y.outerHeight)*r.y+g.top,y.left=(m.outerWidth-y.outerWidth)*r.x+g.left),delete u.outerHeight,delete u.outerWidth,o.css(u),"content"!==c&&"both"!==c||(s=s.concat(["marginTop","marginBottom"]).concat(t),n=n.concat(["marginLeft","marginRight"]),o.find("*[width]").each(function(){var t=l(this),e=l.effects.scaledDimensions(t),o={height:e.height*f.from.y,width:e.width*f.from.x,outerHeight:e.outerHeight*f.from.y,outerWidth:e.outerWidth*f.from.x},e={height:e.height*f.to.y,width:e.width*f.to.x,outerHeight:e.height*f.to.y,outerWidth:e.width*f.to.x};f.from.y!==f.to.y&&(o=l.effects.setTransition(t,s,f.from.y,o),e=l.effects.setTransition(t,s,f.to.y,e)),f.from.x!==f.to.x&&(o=l.effects.setTransition(t,n,f.from.x,o),e=l.effects.setTransition(t,n,f.to.x,e)),h&&l.effects.saveStyle(t),t.css(o),t.animate(e,i.duration,i.easing,function(){h&&l.effects.restoreStyle(t)})})),o.animate(y,{queue:!1,duration:i.duration,easing:i.easing,complete:function(){var t=o.offset();0===y.opacity&&o.css("opacity",u.opacity),h||(o.css("position","static"===a?"relative":a).offset(t),l.effects.saveStyle(o)),e()}})})});
|