smile
デカすぎた
// forked from chabudai's doraを描いてみた
// デカすぎた
package {
import flash.display.Sprite;
[SWF(width="465", height="465", backgroundColor="0x000000", frameRate="30")]
public class Smile extends Sprite
{
public var sp:Sprite;
private var centerX:Number;
private var centerY:Number;
private var fcolor:int = 0xFFFF00;
private var color:int = 0x000000;
public function Smile() {
centerX = stage.stageWidth / 2;
centerY = stage.stageHeight / 2;
sp = new Sprite();
sp.x = centerX;
sp.y = centerY;
addChild(sp);
var face:Sprite = new Sprite();
var r:int = 200;
face.graphics.beginFill(fcolor);
face.graphics.drawCircle( 0, 0, r);
face.graphics.endFill();
var lefteye:Sprite = new Sprite();
lefteye.x = -85;
lefteye.y = -85;
drawOval(lefteye, 35, 70);
var righteye:Sprite = new Sprite();
righteye.x = 55;
righteye.y = -85;
drawOval(righteye, 35, 70);
var mouse:Sprite = new Sprite();
mouse.graphics.lineStyle(12, color);
mouse.graphics.moveTo( -131, 45);
mouse.graphics.curveTo( -84, 130, 0, 130);
mouse.graphics.curveTo(84, 130, 131, 45);
var leftcheek:Sprite = new Sprite();
leftcheek.x = -120;
leftcheek.y = 27;
drawOval(leftcheek, 15, 40);
leftcheek.rotation = 50;
var rightcheek:Sprite = new Sprite();
rightcheek.x = 113;
rightcheek.y = 37;
drawOval(rightcheek, 15, 40);
rightcheek.rotation = -50;
sp.addChild(face);
sp.addChild(lefteye);
sp.addChild(righteye);
sp.addChild(mouse);
sp.addChild(leftcheek);
sp.addChild(rightcheek);
}
private function drawOval(s:Sprite, w:Number, h:Number):void {
s.graphics.beginFill(color, 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();
}
}
}