Skip to content

Instantly share code, notes, and snippets.

@spektraldevelopment
Last active September 4, 2015 18:42
Show Gist options
  • Save spektraldevelopment/8f23f39fbb06149ffb84 to your computer and use it in GitHub Desktop.
Save spektraldevelopment/8f23f39fbb06149ffb84 to your computer and use it in GitHub Desktop.
A method for animating blurs in TweenLite.
function blurTo(el, speed, blurAmount, startAmount, endAmount, callback) {
var
speed = speed || 1,
startAmount = startAmount || 10,
endAmount = endAmount || 0,
blur = { a:startAmount };
TweenLite.to(blur, speed, {a: endAmount, onUpdate: applyBlur, onUpdateParams:[el, blur], onComplete: callback});
function applyBlur(el, blurAmount) {
TweenLite.set(el, {
webkitFilter:"blur(" + blurAmount.a + "px)",
filter:"blur(" + blurAmount.a + "px)"
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment