
Some time ago I developed some distortion classes in order to achieve an rgb split effect and some random perlin noise. I found out that a small “engine” for those purposes would sometimes be very useful (at least to me), so today I finally had time to wrap it up.
To call it an engine is maybe a bit overstated, actually it’s just a quick way to set up different types of distortion and change the amount of distortion applied.
In these examples I have used it with TweenMax, and I have tweened the distortion value from 0 to 4 and back to 0 (you can apply any amount you want, 4 is just what I used).
The engine has 5 different distortion types, below are examples of each:
Cubic noise
Distort
Noise
Perlin noise
RGB distort (split effect)
Click here to download the files with a small example
The basic syntax is as simple as this:
DistortEngine.init("rgbDistort", _distortionTarget, {horizontal:true, vertical:true, rotation:true, transparent:true});
TweenMax.to(this, 1, {_power:0, ease:Quad.easeInOut, bezierThrough:[{_power:4}], onUpdate:distort, onComplete:removeDistortion});
private function removeDistortion():void
{
DistortEngine.remove(_distortionTarget);
}
private function distort():void
{
DistortEngine.distort(_distortionTarget, _power);
}I don’t really have time (or motivation) for writing a documentation, but it should be really easy for an actionscript developer to use this and also adjust some specific properties for the filters/distortions.
NB: The example uses TweenMax, download it here!
2 Comments
oi nice one mate
Excuse my french but, This post makes my mind spin at the speed of dark.