/**
* Copyright ProjectNya ( http://wonderfl.net/user/ProjectNya )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/isLM
*/
////////////////////////////////////////////////////////////////////////////////
// どきどき♥
// forked from zahir's hart [http://wonderfl.net/c/k6dm]
//
// 線でマスク
// http://www.project-nya.jp/modules/weblog/details.php?blog_id=596
// [AS3.0] ぼよよんと出る
// http://www.project-nya.jp/modules/weblog/details.php?blog_id=1058
////////////////////////////////////////////////////////////////////////////////
package {
import flash.display.Sprite;
import flash.display.MovieClip;
import flash.events.Event;
import flash.display.LineScaleMode;
import flash.display.CapsStyle;
import flash.display.JointStyle;
import flash.filters.BlurFilter;
import flash.text.TextField;
import flash.text.TextFieldType;
import flash.text.TextFieldAutoSize;
import flash.text.AntiAliasType;
import flash.text.TextFormat;
import flash.text.TextFormatAlign;
[SWF(backgroundColor="#FFFFFF", width="465", height="465", frameRate="30")]
public class Main extends Sprite {
private var txt:TextField;
private var heart:Sprite;
private static var blur:BlurFilter = new BlurFilter(32, 32, 3);
private static var baseScale:Number = 0.4;
private static var targetScale:Number = 0.7;
private var scale:Number = baseScale;
private var amplitude:Number = 0;
private static var deceleration:Number = 0.85;
private static var friction:Number = 0.8;
private static var acceleration:Number = 0.4;
public function Main() {
init();
}
private function init():void {
graphics.beginFill(0xFF6699);
graphics.drawRect(0, 0, 465, 465);
graphics.endFill();
txt = new TextField();
addChild(txt);
txt.x = 2;
txt.y = 2;
txt.width = 460;
txt.height = 460;
txt.autoSize = TextFieldAutoSize.CENTER;
txt.type = TextFieldType.DYNAMIC;
txt.selectable = false;
//txt.embedFonts = true;
//txt.antiAliasType = AntiAliasType.ADVANCED;
var tf:TextFormat = new TextFormat();
tf.font = "_ゴシック";
tf.size = 18;
tf.align = TextFormatAlign.CENTER;
txt.defaultTextFormat = tf;
txt.textColor = 0xFFFFFF;
txt.multiline = true;
txt.wordWrap = true;
txt.text = "love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love love";
txt.filters = [new BlurFilter(4, 4, 1)];
heart = new Sprite();
heart.graphics.lineStyle(256, 0x000000, 1 , false, LineScaleMode.NORMAL, CapsStyle.ROUND, JointStyle.MITER);
heart.graphics.moveTo(-80, -60);
heart.graphics.lineTo(0, 20);
heart.graphics.lineTo(80, -60);
heart.x = 232;
heart.y = 232;
addChild(heart);
heart.cacheAsBitmap = true;
cacheAsBitmap = true;
mask = heart;
heart.filters = [blur];
heart.scaleX = heart.scaleY = baseScale;
addEventListener(Event.ENTER_FRAME, elastic, false, 0, true);
}
private function elastic(evt:Event):void {
amplitude += targetScale - scale;
scale += amplitude*friction;
amplitude *= deceleration;
heart.scaleX = heart.scaleY = scale;
if (Math.abs(targetScale - scale) < 0.005 && Math.abs(amplitude) < 0.001) {
removeEventListener(Event.ENTER_FRAME, elastic);
amplitude = 0;
scale = targetScale;
heart.scaleX = heart.scaleY = targetScale;
addEventListener(Event.ENTER_FRAME, slide, false, 0, true);
}
}
private function slide(evt:Event):void {
scale += (baseScale - scale)*acceleration;
heart.scaleX = heart.scaleY = scale;
if (Math.abs(baseScale - scale) < 0.005) {
removeEventListener(Event.ENTER_FRAME, slide);
scale = baseScale;
heart.scaleX = heart.scaleY = baseScale;
addEventListener(Event.ENTER_FRAME, elastic, false, 0, true);
}
}
}
}