# \[F8\] Dynamic Filter use

**URL:** <https://forum.kirupa.com/t/f8-dynamic-filter-use/217527>\
**Category:** flash\
**Created:** [February 27, 2007, 6:45pm UTC](https://forum.kirupa.com/t/f8-dynamic-filter-use/217527 "2007-02-27T18:45:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![newbie\_geek](https://avatars.discourse-cdn.com/v4/letter/n/d9b06d/32.png) [@newbie\_geek](https://forum.kirupa.com/u/newbie_geek)\
**Post date:** [February 27, 2007, 6:45pm UTC](https://forum.kirupa.com/t/f8-dynamic-filter-use/217527/1 "2007-02-27T18:45:23Z")

</div>

Hey all,

So i have developed and am refining some “mouse follow” code. The code works great. What doesn’t work is my ability to add a blur effect. The idea is that the faster the mc is moving, the more blurry it is made. Sounds simple… _heh heh_

I have started by simply applying a static blur value in the code… like such:

```auto
	function mouseFollow(centerx:Object, centery:Object, inertia:Number, k:Number) {
		//trace ("we are calling the mouse follow function");
		Dx = -this_mc._x+centerx;
		Dy = -this_mc._y+centery;
		Px = Px*inertia+Dx*k;
		Py = Py*inertia+Dy*k;
		this_mc._x += Px;
		this_mc._y += Py;
		trace(Math.round(Dx/10));
		//
		// blur mechanism
		//
		var blurFilter = new flash.filters.BlurFilter();
		var filterArray:Array = this_mc.filters;
		filterArray.push(blurFilter)
		//
		filterArray[0].blurX = 2;
		this_mc.filters = filterArray;
	}

```

the mc is blurred just fine. But my CPU is PISSED at me. Suggestions for how to best optimize this code? perhaps there is a less brute force way of doing this? Or is the “filter” aspect simply a CPU pig?
