| [Matthias K.] - Moderator
Registriert seit: Jun 2001 Ort: Berlin/Germany - and the hole World !
Beiträge: 9.971
| ColorMatrixFilter (Einsatz der Matrix)
Was zum ausprobieren und umbauen.
Erstes Schlüsselbild: ActionScript: // Original MC orig_mc = this.createEmptyMovieClip("orig_mc", 2); orig_mc._alpha = 0; orig_mc._visible = false; // Loader loader = new MovieClipLoader(); loaderListener = new Object(); loaderListener.onLoadComplete = function() { play(); }; loader.addListener(loaderListener); loader.loadClip("testbild.jpg",orig_mc); stop();
Zweites Schlüsselbild ActionScript: // kopie_mc stellt eine Kopie des original_mc dar kopie_mc = this.createEmptyMovieClip("kopie_mc", 1); bd_obj = new flash.display.BitmapData(orig_mc._width, orig_mc._height, true, 0); bd_obj.draw(orig_mc); kopie_mc.attachBitmap(bd_obj,1,"auto",true); // Filter-effekt (Objekt samt Matrix) graustufen = new flash.filters.ColorMatrixFilter(); graustufen.matrix = new Array( 1/3,1/3,1/3,0,0, 1/3,1/3,1/3,0,0, 1/3,1/3,1/3,0,0, 0, 0, 0, 1,0); // Anwenden des Filters kopie_mc.filters = [graustufen]; // Kleine Spielerei mit der Maus kopie_mc.useHandCursor = false; kopie_mc.onRollOver = function() { orig_mc._visible = true; orig_mc.onEnterFrame = function() { this._alpha += 10; if (this._alpha>=100) { delete this.onEnterFrame; } }; }; kopie_mc.onRollOut = function() { orig_mc.onEnterFrame = function() { this._alpha -= 10; if (this._alpha<=0) { this._visible = false; delete this.onEnterFrame; } }; }; stop();
Hinweis
In Flash 8 sind die Bildformate JPG, GIF und PNG zugelassen.
Ihr könnt jedoch auch eine externe SWF einlesen und mit dem Farbeffekt
versehen.
Graustufen: ActionScript: graustufen.matrix = new Array( 1/3,1/3,1/3,0,0, 1/3,1/3,1/3,0,0, 1/3,1/3,1/3,0,0, 0, 0, 0, 1,0);
Rot: ActionScript: rotstufen.matrix = new Array( 1/3,1/3,1/3,0,0, 0,0,0,0,0, 0,0,0,0,0, 0, 0, 0, 1,0);
Grün: ActionScript: gruenstufen.matrix = new Array( 0,0,0,0,0, 1/3,1/3,1/3,0,0, 0,0,0,0,0, 0, 0, 0, 1,0);
Blau: ActionScript: blaustufen.matrix = new Array( 0,0,0,0,0, 0,0,0,0,0, 1/3,1/3,1/3,0,0, 0, 0, 0, 1,0);
Hinweis
Natürlich könnt Ihr für die Matrix auch andere Werte ausprobieren.
Liebe Grüsse
Matze K.
|