# DrawTriangles() Looks crudy

**URL:** <https://forum.kirupa.com/t/drawtriangles-looks-crudy/317899>\
**Category:** Uncategorized\
**Created:** [January 5, 2011, 4:49pm UTC](https://forum.kirupa.com/t/drawtriangles-looks-crudy/317899 "2011-01-05T16:49:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenBart](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@BenBart](https://forum.kirupa.com/u/BenBart)\
**Post date:** [January 5, 2011, 4:49pm UTC](https://forum.kirupa.com/t/drawtriangles-looks-crudy/317899/1 "2011-01-05T16:49:31Z")

</div>

Is there a way to make DrawTriangles use anti aliasing like it does in the native flash UI.

Code below uses a movieclip on the stage called “testBitmap\_mc” that has stuff inside it and then it draws a triangle and flips it.

```auto
import flash.display.Bitmap;
import flash.display.BitmapData;

var myBitmapData:BitmapData = new BitmapData(testBitmap_mc.width+1, testBitmap_mc.height, true, 0x00ffffff);
myBitmapData.draw(testBitmap_mc,null,null,null,null,true);

removeChild(testBitmap_mc);
var bitmap:Sprite = new Sprite();
addChild(bitmap);
drawBitmap(myBitmapData, 0);
var counter:Number = 0;
var forwards:Boolean = true;

bitmap.x = testBitmap_mc.x;
bitmap.y = testBitmap_mc.y;
function drawBitmap(myBitmapData:BitmapData, percentDone:Number)
{
    //var bitmap:Bitmap = new Bitmap(myBitmapData);
    bitmap.graphics.clear();
    bitmap.graphics.beginBitmapFill(myBitmapData);
    bitmap.graphics.drawTriangles(
    Vector.<Number>([myBitmapData.width *0 + myBitmapData.width * percentDone ,myBitmapData.height *0+ myBitmapData.height*percentDone * .25, myBitmapData.width * .7,0, 0,myBitmapData.height * .7]),
    Vector.<int>([0,1,2]),
    Vector.<Number>([0,0, .7,0, 0,.7]));
    //bitmap.graphics.drawRect(0,0, myBitmapData.width, myBitmapData.height);
    bitmap.graphics.endFill();
} 

addEventListener(Event.ENTER_FRAME, rollShard);

function rollShard(e:Event)
{
    if(forwards)
    {
    counter+=.05;
        if(counter >=1) 
        {
            forwards = false;
            counter -=.05;
        }
    }
    else
    {
        counter-=.05;
        if(counter <=-1) 
        {
            forwards = true;
            counter +=.05;
        }
    }
    drawBitmap(myBitmapData, counter);
}

```
