Last active
September 4, 2015 18:42
-
-
Save spektraldevelopment/8f23f39fbb06149ffb84 to your computer and use it in GitHub Desktop.
A method for animating blurs in TweenLite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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