20 Replies Latest reply on Nov 14, 2007 9:40 PM by kglad

    AS 3.0 - Animate Blur Filter...

    C-Rock Level 2
      I've looked for a few days and I can't find out how to animate a blur filter with actionscript. I have a box on the stage that I'm tweening and I just want to add motion blur to it. I'm trying to use the MOTION_CHANGE listener but no luck yet. Thanks!
        • 1. Re: AS 3.0 - Animate Blur Filter...
          Greg Dove Level 4
          I used to use Fuse to animate filters in as2. I was just reading yesterday about what Moses is up working on now.

          http://blog.mosessupposes.com/?p=20

          I'm going to check it out (the 'go' framework) later this week, but it seems to be a relevant example in that post, if it works.

          • 2. Re: AS 3.0 - Animate Blur Filter...
            C-Rock Level 2
            I've been using the Fuse as well and waiting for something for AS 3.0. I've looked at the go and from what I can see it's not the same thing as Fuse. You think Flash would have this in the help docs or something.

            I can't be the only developer on planet earth trying to blur a tween object...
            • 3. Re: AS 3.0 - Animate Blur Filter...
              Greg Dove Level 4
              No its not the same, I realise. Its quite possible that you may be the only developer on planet earth trying to blur a tween object, but I suspect that's not what you meant ;-)

              I've also done blur tweens 'the hard way' in as2, Could you not write something to do that just using enterFrame and a counter variable? I can't remember the details but I realise its a little more complicated because you can't change the values directly in the filters array...(if I remember correctly) - if it works the same way as as2, so you have to get a copy and then change it and reapply it (again, memory is a little hazy).
              • 4. Re: AS 3.0 - Animate Blur Filter...
                C-Rock Level 2
                I can do it now, but the thing is that the easing of my tween doesn't match the "countdown" of the amount of blur I'm removing during the animation as it slows down. Fuse used to make this so easy. There has to be some engine or something out, CS3 has been out for 5 months...
                • 5. Re: AS 3.0 - Animate Blur Filter...
                  Mister Peanut Level 1
                  I'm trying to manually tween a blurred mc, and am having great difficulties. Is this just not possible to do without slowing down your swf tremendously?
                  • 6. Re: AS 3.0 - Animate Blur Filter...
                    Greg Dove Level 4
                    @c-rock: yeah, it was easy to do with Fuse. But I'm not sure there will ever be a Fuse 3...
                    You might be able to get it right if you can get access to the easing value the regular tween is using in the enterFrame updates and use it to calculate the new Blur value. I don't know if that's possible with whatever tweening approach you're using. Or you could maybe convert your other tween to linear to synchronise the effects.

                    Mr Peanut: Bitmap filters are a little CPU intensive to animate. I guess it would depend on the quality settings for the filter as well.
                    • 7. Re: AS 3.0 - Animate Blur Filter...
                      C-Rock Level 2
                      Fuse 3 is coming, it's just taking too long. I don't think any other tweening engines are using easing though or I would try them for now.

                      I'm using the TweenEvent.MOTION_CHANGE to call a function that will countdown the blur value until it is zero.

                      Flash is supposed to be more advanced and flexible with 3.0 not less. It is still animation software so we should have never lost any of that.
                      • 8. Re: AS 3.0 - Animate Blur Filter...
                        Greg Dove Level 4
                        Moses uses phrases like "Fuse 3 (if built) will be ...."

                        which doesn't give me a lot of confidence given that its already later than originally heralded.

                        I just checked the docs. In the Tween instance there's a position property which is the output of whatever easing function you used. You should be able to use that to help align the value for the Blur if you check it in your enterFrame loop. I don't use the standard Tween class so had to check... but that's how I'd approach it.
                        • 9. Re: AS 3.0 - Animate Blur Filter...
                          C-Rock Level 2
                          the enterFrame in 3.0 sucks because it shows the item in the display list first before it works.

                          i used to use the onClipEvent with 2.0 and it works great. i currently have no animation abilities with these problems! it's making me quite angry.

                          moses has a huge group of people that's he's recruited to build Fuse 3 so I'm sure they'll get it done.

                          how do you or anyone else for that matter tween filters without using the timeline? what's the preferred method right now?
                          • 10. Re: AS 3.0 - Animate Blur Filter...
                            Greg Dove Level 4
                            Sorry I can't answer that for as3, because I haven't done a lot in as3 yet. I've made a decision to really focus after my current project is live. The September player stats put player 8 at 99% and player 9 at 93%. I've done bits and pieces in as3, mainly helping others as I learn at the same time.
                            I think its finally time for me to make the 'change'. I'll be taking a look at the other packages Moses mentions and checking out 'go' as well later this week .

                            I've also used Alex Uhlmann's Animation package a little in as2, but not for Filters. But it looks like it covers filters (just not in the easy way that FuseFMP did). And there's an 'alpha' as3 version. You may want to check it out.

                            http://www.alex-uhlmann.de/flash/animationpackage/ap3/index.htm
                            • 11. Re: AS 3.0 - Animate Blur Filter...
                              kglad Adobe Community Professional & MVP
                              do you want to use a timer listener, enterframe listener or tween to animate your blur?
                              • 12. Re: AS 3.0 - Animate Blur Filter...
                                C-Rock Level 2
                                a tween because i'm using a tween for the motion of the object already.
                                • 13. Re: AS 3.0 - Animate Blur Filter...
                                  kglad Adobe Community Professional & MVP
                                  to apply an animated blur to mc:



                                  • 14. Re: AS 3.0 - Animate Blur Filter...
                                    Greg Dove Level 4
                                    kglad: that looks good, I don't use the standard Tween classes much, so it's helpful to see the approach you use for tweening filters.
                                    Q:Would it not be better to just apply the blur as an array containing a single element?
                                    myFilters=[ filter ];
                                    instead of myFilters.push(filter);
                                    (in the example here)
                                    Otherwise isn't it applying cumulative blur filters as the tween progresses, rather than just changing one blur filter? If it is I don't know what that might do for performance.
                                    • 15. Re: AS 3.0 - Animate Blur Filter...
                                      kglad Adobe Community Professional & MVP
                                      oops. you're more than correct gwd.

                                      i just copied and pasted bits of flash help file code and didn't pay attention to the end result. it's actually worse than just causing myFilters to grow larger with each push: each myFilter member is applied each time mc.filters = myFilters is executed. so, by the end of the tween, mc is being blurred several times on each call of f().

                                      the code should be:

                                      • 16. Re: AS 3.0 - Animate Blur Filter...
                                        C-Rock Level 2
                                        where's the include class to use the BitmapFilter?
                                        • 17. Re: AS 3.0 - Animate Blur Filter...
                                          kglad Adobe Community Professional & MVP
                                          it's not needed.
                                          • 18. Re: AS 3.0 - Animate Blur Filter...
                                            C-Rock Level 2
                                            Found it.

                                            It only animates to blur 10. I can't change the numbers in the tween to make it animate from blur 10.

                                            I should be able to change the blurX and Y values to 10 and then do this right?
                                            • 19. Re: AS 3.0 - Animate Blur Filter...
                                              C-Rock Level 2
                                              Nevermind your last code you fixed worked correctly. Thanks so much for your help, again.

                                              I may have to start sending you half of my paychecks soon. :)
                                              • 20. Re: AS 3.0 - Animate Blur Filter...
                                                kglad Adobe Community Professional & MVP
                                                you're welcome. (and i sure hope you're getting paid a lot of money, if i'm going to get 1/2.)