Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 04-09-2003, 19:23   #1 (permalink)
...
 
Registriert seit: Oct 2002
Ort: Nürnberg
Beiträge: 3.611
beste API-Methode

hi, ich versuche gerade die flexiebelste loesung zum zeichnen eines 3d quaders in der iso ansicht.
hab mal zwei moeglichkeiten gemacht.
weis noch jemand wie man es besser machen koennte? (kuerzerer code, bessere performance)
ActionScript:
  1. var m = this.createEmptyMovieClip("cont", 1);
  2. m.lineStyle(0);
  3. //draw Array
  4. d_array = new Array();
  5. d_array[0] = [0xCCCCCC, [-20, 0], [0, 10], [0, 0], [-20, -10], [-20, 0]];
  6. d_array[1] = [0x666666, [0, 10], [20, 0], [20, -10], [0, 0], [0, 10]];
  7. d_array[2] = [0xFFFFFF, [-20, -10], [0, -20], [20, -10], [0, 0], [-20, -10]];
  8. for (var j = 0; j<4; j++) {
  9.     m.beginFill(d_array[j][0]);
  10.     m.moveTo(d_array[j][1][0], d_array[j][1][1]);
  11.     for (var u = 1; u<6; u++) {
  12.         m.lineTo(d_array[j][u][0], d_array[j][u][1]);
  13.     }
  14.     m.endFill();
  15. }
  16. ///
  17. ///
  18. // andere Methode
  19. var k = this.createEmptyMovieClip("cont1", 2);
  20. k._x = 100;
  21. k.lineStyle(0);
  22. // left
  23. k.beginFill(0xcccccc);
  24. k.moveTo(-20, 0), k.lineTo(0, 10), k.lineTo(0, 0), k.lineTo(-20, -10), k.lineTo(-20, 0);
  25. k.endFill();
  26. // rigth
  27. k.beginFill(0x666666);
  28. k.moveTo(0, 10), k.lineTo(20, 0), k.lineTo(20, -10), k.lineTo(0, 0), k.lineTo(0, 10);
  29. k.endFill();
  30. //top
  31. k.beginFill(0xffffff);
  32. k.moveTo(-20, -10), k.lineTo(0, -20), k.lineTo(20, -10), k.lineTo(0, 0), k.lineTo(-20, -10);
  33. k.endFill();
thorben.schmitt ist offline   Mit Zitat antworten
Alt 04-09-2003, 21:03   #2 (permalink)
netTrek
 
Benutzerbild von netTrek
 
Registriert seit: Jul 2001
Ort: 46282 Dorsten
Beiträge: 2.972
Mir gefällt die erste Variante und an dieser würde ich nur die Array Erstellung "optimieren" / anders machen:

ActionScript:
  1. var m = this.createEmptyMovieClip("cont", 1);
  2. m.lineStyle(0);
  3.  
  4. d_array = [ [0xCCCCCC, [-20, 0], [0, 10], [0, 0], [-20, -10], [-20, 0]],
  5.             [0x666666, [0, 10], [20, 0], [20, -10], [0, 0], [0, 10]],
  6.             [0xFFFFFF, [-20, -10], [0, -20], [20, -10], [0, 0], [-20, -10]]
  7.           ]
  8. for (var j = 0; j<4; j++) {
  9.         m.beginFill(d_array[j][0]);
  10.         m.moveTo(d_array[j][1][0], d_array[j][1][1]);
  11.         for (var u = 1; u<6; u++) {
  12.                 m.lineTo(d_array[j][u][0], d_array[j][u][1]);
  13.         }
  14.         m.endFill();
  15. }

SABAN
__________________
Saban Ünlü

netTrek GmbH & Co. KG
Softwareentwicklung, Design & Konzeption
www.netTrek.de
netTrek ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 19:51 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele