В de.popforge.wm2006.effect.Flag заменить следующие методы (белым отмечены параметры отвечающие за направление)
Код:
public function enterFrame(): Void {
//-- clear output
output.fillRect( bounds, 0 );
//-- apply wind
perlinNoiseOffset[0].x += .04 * source.width;
perlinNoiseOffset[1].x -= .03 * source.height;
//-- update perlinNoise
perlinNoiseBitmapData.perlinNoise( .66 * source.width, .66 * source.height, 2, perlinNoiseSeed, false, true, 6, false, perlinNoiseOffset );
//-- reduce perlinNoise on the left side
perlinNoiseBitmapData.copyPixels( perlinNoiseFallOff, bounds, ORIGIN, perlinNoiseFallOff, ORIGIN, true );
//-- apply displacement
output.applyFilter( flag, bounds, ORIGIN, displacement );
//-- copy displacement onto lights-bitmapData with alpha from current output
light.copyPixels( perlinNoiseBitmapData, bounds, ORIGIN, output, ORIGIN );
//-- turn perlinNoise into gray
light.applyFilter( light, bounds, ORIGIN, gray );
//-- draw onto output by blendMode MULTIPLY
output.draw( light, IDENTITY, lightContrast, 'multiply' );
}
Код:
private function createPerlinNoiseFallOffGradient(): Void {
perlinNoiseFallOff = new BitmapData( width, height, true, 0 );
//-- need a container for drawing
var shape: MovieClip = _root.createEmptyMovieClip( 'shapeCreator', _root.getNextHighestDepth() );
//-- move shape outside stage to draw transparent
shape._y = -16000;
//-- create matrix
var gradientBox: Matrix = new Matrix();
gradientBox.createGradientBox( width - flagOffset.x, height, 0, flagOffset.x, 0 );
//-- draw gradient
shape.beginGradientFill( 'linear', [ 0x008080, 0x008080 ], [ 0, 100 ], [ 0x60, 0xF0], gradientBox );
shape.moveTo( 0, 0 );
shape.lineTo( width, 0 );
shape.lineTo( width, height );
shape.lineTo( 0, height );
shape.lineTo( 0, 0 );
shape.endFill();
//-- draw to bitmapData
perlinNoiseFallOff.draw( shape );
//-- remove shape
shape.removeMovieClip();
}
|