forked from: Pure AS3 RSS Icon
Pure AS3 RSS Icon
See: http://d.hatena.ne.jp/nitoyon/20070830/rss_icon_as3
Special Thanks: http://www.drweb.de/photoshop/rss-icon.shtml
// forked from nitoyon's Pure AS3 RSS Icon
// Pure AS3 RSS Icon
// See: http://d.hatena.ne.jp/nitoyon/20070830/rss_icon_as3
// Special Thanks: http://www.drweb.de/photoshop/rss-icon.shtml
package
{
import flash.display.*;
import flash.filters.*;
import flash.geom.*;
[SWF(width="128", height="128")]
public class RssIcon extends Sprite
{
private const SIZE:int = 128;
private const ROUND:int = 48;
public function RssIcon():void
{
stage.scaleMode = "noScale";
var matrix:Matrix = new Matrix();
matrix.createGradientBox(SIZE, SIZE, Math.PI * 1 / 4);
var glowFilter:GlowFilter = new GlowFilter(0xffffbe, 0.75);
glowFilter.inner = true;
// 外側の角円四角
var base:Shape = new Shape();
base.graphics.beginFill(0xcc6611);
base.graphics.drawRoundRect(0, 0, SIZE, SIZE, ROUND, ROUND);
base.graphics.endFill();
addChild(base);
// 内側の角円四角
var base2:Shape = new Shape();
base2.graphics.beginFill(0xee7722);
base2.graphics.drawRoundRect(1, 1, SIZE - 2, SIZE - 2, ROUND - 1, ROUND - 1);
base2.graphics.endFill();
base2.filters = [glowFilter];
addChild(base2);
// グラデーション
var gross:Shape = new Shape();
gross.graphics.beginGradientFill("linear", [0xffffff, 0x000000], [0.2, 0.2], [0, 255], matrix);
gross.graphics.drawRoundRect(0, 0, SIZE, SIZE, ROUND, ROUND);
gross.graphics.endFill();
gross.graphics.beginGradientFill("linear", [0xffffff, 0xffffff, 0xffffff], [0, 0.2, 0], [0, 112, 255], matrix);
gross.graphics.drawRoundRect(0, 0, SIZE, SIZE, ROUND, ROUND);
gross.graphics.endFill();
gross.blendMode = BlendMode.OVERLAY;
addChild(gross);
// ●
var white:Shape = new Shape();
white.graphics.beginFill(0xffffff);
white.graphics.drawCircle(36, 96, 12);
white.graphics.endFill();
// ))
drawPattern3(white.graphics);
addChild(white);
}
private function drawPattern3(g:Graphics):void
{
g.beginFill(0xffffff);
drawPie(g, 24, 106, 56, -Math.PI / 2, 0);
drawPie(g, 24, 106, 40, -Math.PI / 2, 0);
g.endFill();
g.beginFill(0xffffff);
drawPie(g, 24, 106, 86, -Math.PI / 2, 0);
drawPie(g, 24, 106, 70, -Math.PI / 2, 0);
g.endFill();
}
// 弧を描くメソッド
// (参考) http://www.fumiononaka.com/TechNotes/Flash/FN0506002.html
private function arcTo(g:Graphics, x:Number, y:Number, radius:Number, startAngle:Number, endAngle:Number):void
{
var clockwise:Boolean = startAngle < endAngle;
g.lineTo(x + radius * Math.cos(startAngle), y + radius * Math.sin(startAngle));
while(clockwise && startAngle < endAngle || !clockwise && startAngle > endAngle)
{
var nextAngle:Number = clockwise ? Math.min(endAngle, startAngle + Math.PI / 4)
: Math.max(endAngle, startAngle - Math.PI / 4);
var nextPos:Point = new Point(
Math.cos(nextAngle) * radius,
Math.sin(nextAngle) * radius);
var controlPos:Point = new Point(
radius * Math.tan((nextAngle - startAngle) / 2) * Math.cos(nextAngle - Math.PI / 2),
radius * Math.tan((nextAngle - startAngle) / 2) * Math.sin(nextAngle - Math.PI / 2)
);
g.curveTo(x + nextPos.x + controlPos.x, y + nextPos.y + controlPos.y, x + nextPos.x, y + nextPos.y);
startAngle = nextAngle;
}
}
// 扇形を描くメソッド
private function drawPie(g:Graphics, x:Number, y:Number, radius:Number, startAngle:Number, endAngle:Number):void
{
g.moveTo(x, y);
arcTo(g, x, y, radius, startAngle, endAngle);
}
}
}