2012-04-30 20 views

答えて

1

私は最近、Stage3D上に線を描画するために、単純なライブラリーを書きました。
ゼブロイドといい、https://github.com/luwes/Zebroid

ゼブロイドはまだラインキャップやジョイントをサポートしていません。

2

あなたはこれを試すことができます。

/** 
* Class Line 
* @author Leandro Barreto 2012 
* @version 1.0 
**/ 

package starling.utils 
{ 
    import starling.display.Quad; 
    import starling.display.Sprite; 

    public class Line extends Sprite 
    { 
     private var baseQuad:Quad; 
     private var _thickness:Number = 1; 
     private var _color:uint = 0x000000; 

     public function Line() 
     { 
      baseQuad = new Quad(1, _thickness, _color); 
      addChild(baseQuad); 
     } 

     public function lineTo(toX:int, toY:int):void 
     { 
      baseQuad.width = Math.round(Math.sqrt((toX*toX)+(toY*toY))); 
      baseQuad.rotation = Math.atan2(toY, toX); 
     } 

     public function set thickness(t:Number):void 
     { 
      var currentRotation:Number = baseQuad.rotation; 
      baseQuad.rotation = 0; 
      baseQuad.height = _thickness = t; 
      baseQuad.rotation = currentRotation; 
     } 

     public function get thickness():Number 
     { 
      return _thickness; 
     } 

     public function set color(c:uint):void 
     { 
      baseQuad.color = _color = c; 
     } 

     public function get color():uint 
     { 
      return _color; 
     } 
    } 
} 

誰かが私たちが2点を結ぶいくつかの大腿四頭筋を描くラインクラスを作成スターリングフォーラムで提案しました。このチュートリアルでは、シェーダのためAGALを使用してポリゴンを作成する方法を示します。

http://wiki.starling-framework.org/manual/custom_display_objects

関連する問題