javascript - Animate blur filter with GSAP - Stack Overflow

I want to create some kind of zoom out animated effect using GSAP. What I'm trying to do is scalin

I want to create some kind of zoom out animated effect using GSAP. What I'm trying to do is scaling an element from double its size to the normal size and apply a vanishing blur filter. The filter should start at blur(15px) and going down to blur(0).

I thought I could do it this way:

var el = $('img');

TweenLite.set(el, {
  'webkitFilter': 'blur(15px)',
  scale: 2
});
TweenLite.to(el, 0, {
  autoAlpha: 1,
  delay: 1.75,
  ease: Power2.easeIn
}); 
TweenLite.to(el, 2, {
  'webkitFilter': 'blur(0px)',
  scale: 1,
  delay: 1.7,
  ease: Power2.easeIn
});

What happens, instead, is that the blur(0) gets applied immediately.

Here's a simple pen showing the problem. What am I doing wrong?

I want to create some kind of zoom out animated effect using GSAP. What I'm trying to do is scaling an element from double its size to the normal size and apply a vanishing blur filter. The filter should start at blur(15px) and going down to blur(0).

I thought I could do it this way:

var el = $('img');

TweenLite.set(el, {
  'webkitFilter': 'blur(15px)',
  scale: 2
});
TweenLite.to(el, 0, {
  autoAlpha: 1,
  delay: 1.75,
  ease: Power2.easeIn
}); 
TweenLite.to(el, 2, {
  'webkitFilter': 'blur(0px)',
  scale: 1,
  delay: 1.7,
  ease: Power2.easeIn
});

What happens, instead, is that the blur(0) gets applied immediately.

Here's a simple pen showing the problem. What am I doing wrong?

Share Improve this question asked Apr 26, 2016 at 20:58 CarloCarlo 4,1687 gold badges49 silver badges70 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

Have you tried just updating to GSAP 1.18.4? Seems to work in your codepen. The CDN link to TweenMax 1.18.4 is https://cdnjs.cloudflare./ajax/libs/gsap/1.18.4/TweenMax.min.js

you can't really animate the blur filter, but you can set it. You can basically set up a timeline and use the progression of the timeline as the method to set the filter over the timeline duration. below is update function that sets the blur over the timeline duration.

  onUpdate:function(tl){
    var tlp = (tl.progress()*40)>>0;
    TweenMax.set('#blur img',{'-webkit-filter':'blur(' + tlp + 'px' + ')','filter':'blur(' + tlp + 'px' + ')'});

      var heading = $('#blur h3');
    heading.text('blur(' + tlp + 'px)');
  }

here is a great demo made by Marzullo http://codepen.io/jonathan/pen/ZWOmmg

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744098705a4558424.html

相关推荐

  • javascript - Animate blur filter with GSAP - Stack Overflow

    I want to create some kind of zoom out animated effect using GSAP. What I'm trying to do is scalin

    8天前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信