doraを描いてみた
package {
import flash.display.Sprite;
[SWF(width="465", height="465", backgroundColor="0x000000", frameRate="30")]
public class Dora extends Sprite
{
public var sp:Sprite;
private var centerX:Number;
private var centerY:Number;
public function Dora() {
centerX = stage.stageWidth / 2;
centerY = stage.stageHeight / 2;
sp = new Sprite();
sp.x = centerX;
sp.y = centerY;
addChild(sp);
var head:Sprite = new Sprite();
var w:Number = 94;
var h:Number = 82;
head.graphics.beginFill(0x6600CC);
head.graphics.moveTo(-w/2, 0);
head.graphics.curveTo(-w/2+2, -h/2+1, 0, -h/2);
head.graphics.curveTo(w/2-2, -h/2+1, w/2, 0);
head.graphics.curveTo(w/2-1, h/2-1, 0, h/2);
head.graphics.curveTo(-w/2+1, h/2-1, -w/2, 0);
head.graphics.endFill();
var face:Sprite = new Sprite();
face.y = 7;
w = 86;
h = 67;
face.graphics.beginFill(0x000000);
face.graphics.moveTo(-w/2, 0);
face.graphics.curveTo(-w/2+2, -h/2+1, 0, -h/2);
face.graphics.curveTo(w/2-2, -h/2+1, w/2, 0);
face.graphics.curveTo(w/2-1, h/2-1, 0, h/2);
face.graphics.curveTo( -w/2+1, h/2 - 1, -w/2, 0);
var lefteye:Sprite = new Sprite();
lefteye.x = -17.5;
lefteye.y = -35;
drawOval(lefteye, 17, 19);
var righteye:Sprite = new Sprite();
righteye.x = 0.5;
righteye.y = -35;
drawOval(righteye, 17, 19);
var nose:Sprite = new Sprite();
nose.x = -5.5;
nose.y = -20;
drawOval(nose, 11, 9);
var noseline:Sprite = new Sprite();
noseline.graphics.lineStyle(1, 0xFFFFFF);
noseline.graphics.moveTo( -0.5, -18);
noseline.graphics.lineTo( -0.5, 24);
var mouse:Sprite = new Sprite();
mouse.graphics.lineStyle(1, 0xFFFFFF);
mouse.graphics.moveTo( -31, 6);
mouse.graphics.curveTo( -24, 24, 0, 24);
mouse.graphics.curveTo(24, 24, 31, 6);
var higeR:Sprite = new Sprite();
higeR.graphics.lineStyle(1, 0xFFFFFF);
higeR.graphics.moveTo( -16, -13);
higeR.graphics.lineTo( -35, -16);
higeR.graphics.moveTo( -17, -9);
higeR.graphics.lineTo( -36, -9);
higeR.graphics.moveTo( -16, -5);
higeR.graphics.lineTo( -35, -2);
var higeL:Sprite = new Sprite();
higeL.graphics.lineStyle(1, 0xFFFFFF);
higeL.graphics.moveTo( 16, -13);
higeL.graphics.lineTo( 35, -16);
higeL.graphics.moveTo( 17, -9);
higeL.graphics.lineTo( 36, -9);
higeL.graphics.moveTo( 16, -5);
higeL.graphics.lineTo( 35, -2);
sp.addChild(head);
sp.addChild(face);
sp.addChild(lefteye);
sp.addChild(righteye);
sp.addChild(nose);
sp.addChild(noseline);
sp.addChild(mouse);
sp.addChild(higeR);
sp.addChild(higeL);
}
private function drawOval(s:Sprite, w:Number, h:Number):void {
s.graphics.beginFill(0xFFFFFF, 100);
s.graphics.moveTo(0, h/2);
s.graphics.curveTo(0.5, 0.5, w/2, 0);
s.graphics.curveTo(w-0.5, 0.5, w, h/2);
s.graphics.curveTo(w-0.5, h-0.5, w/2, h);
s.graphics.curveTo(0.5, h-0.5, 0, h/2);
s.graphics.endFill();
}
}
}