1// Custom plugin to add 'blur' property 2// Usage: gsap.to(target, {blur:10}) and it'll feed that value to this plugin 3// which will do all the necessary calculations to add/update a blur() value 4// in the CSS "filter" property (in browsers that support it). 5 6// Source, found in the gsap forums: 7// https://codepen.io/GreenSock/pen/NWKjEBG 8 9(function() { 10 const blurProperty = gsap.utils.checkPrefix("filter"), 11 blurExp = /blur\((.+)?px\)/, 12 getBlurMatch = target => 13 (gsap.getProperty(target, blurProperty) || "").match(blurExp) || []; 14 15 gsap.registerPlugin({ 16 name: "blur", 17 get(target) { 18 return +getBlurMatch(target)[1] || 0; 19 }, 20 init(target, endValue) { 21 let data = this, 22 filter = gsap.getProperty(target, blurProperty), 23 endBlur = "blur(" + endValue + "px)", 24 match = getBlurMatch(target)[0], 25 index; 26 if (filter === "none") { 27 filter = ""; 28 } 29 if (match) { 30 index = filter.indexOf(match); 31 endValue = 32 filter.substr(0, index) + 33 endBlur + 34 filter.substr(index + match.length); 35 } else { 36 endValue = filter + endBlur; 37 filter += filter ? " blur(0px)" : "blur(0px)"; 38 } 39 data.target = target; 40 data.interp = gsap.utils.interpolate(filter, endValue); 41 }, 42 render(progress, data) { 43 data.target.style[blurProperty] = data.interp(progress); 44 } 45 }); 46})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.