金魚鉢
package {
import flash.display.Sprite;
import flash.events.*;
import flash.filters.DropShadowFilter;
// Tweener
import caurina.transitions.Tweener;
[SWF(width = "465", height = "465", backgroundColor = 0xffffff, frameRate = "60")]
public class _Happy_Birthday_Mom_0114 extends Sprite{
private var handH:Sprite=new Sprite();
private var handM:Sprite=new Sprite();
private var handS:Sprite=new Sprite();
private var _fish:goldfish;
private var _bluefish:goldfish;
public function _Happy_Birthday_Mom_0114(){if (stage) init();else addEventListener(Event.ADDED_TO_STAGE,init );}
public function init(ev:Event = null){
removeEventListener( Event.ADDED_TO_STAGE, init ) ;
var bg:back_ground=new back_ground();
addChildAt(bg,0);
func_Hand();
func_fish();
}
private function func_Hand(){
handH.graphics.lineStyle(15,0xffffff);
handH.graphics.moveTo(0,-20);
handH.graphics.lineTo(0,-100);
handM.graphics.lineStyle(10,0xffffff);
handM.graphics.moveTo(0,-40);
handM.graphics.lineTo(0,-150);
handS.graphics.lineStyle(5,0xffffff);
handS.graphics.moveTo(0,-30);
handS.graphics.lineTo(0,-170);
handH.x=handH.y=handM.x=handM.y=handS.x=handS.y=465/2;
handH.alpha=handM.alpha=handS.alpha=0.95
handH.filters = handM.filters =handS.filters =[ new DropShadowFilter(2,90,0x2E6B95,1,16,16,2) ] ;
addChildAt(handH,1);addChildAt(handM,1);addChildAt(handS,1);
stage.addEventListener(Event.ENTER_FRAME,render);
}
private function render(ev){
var dd:Date = new Date();
handH.rotation = dd.hours * 30;
handM.rotation = dd.minutes * 6;
handS.rotation = dd.seconds * 6+dd.milliseconds/60*360/1000;
if(dd.seconds%2==0&&dd.milliseconds==0){
var _aqua:aqua=new aqua();
_aqua.x=465/2;_aqua.y=400;
_aqua.addEventListener(Event.ENTER_FRAME,render_aqua);
addChild(_aqua);
}
}
private function render_aqua(ev){
var _mc=ev.target;
if(_mc.y>80){
_mc.y-=0.5;
var _radian:Number = _mc.angel* Math.PI / 180;
_mc.x = _mc.radius * Math.sin(_radian)+465/2;
_mc.angel+=1;
}else{
_mc.removeEventListener(Event.ENTER_FRAME,render_aqua);
removeChild(_mc);
_mc=null;
}
}
//goldfish////////////////////////////////////////////////////////////////////////////////////////////////////
private function func_fish(){
_fish=new goldfish();
_fish.x=_fish.y=465/2;
_fish.scaleX=_fish.scaleY=1.2;
addChildAt(_fish,1);
fish_pos1();
_fish.addEventListener(MouseEvent.MOUSE_DOWN, click_Surprised);
_bluefish=new goldfish();
_bluefish.x=_bluefish.y=465/2;
_bluefish.filters =[ new DropShadowFilter(160,90,0x2E6B95,0.3,16,16,2,2,false,true) ] ;
_bluefish.addEventListener(Event.ENTER_FRAME,function(ev){_bluefish.x=_fish.x;_bluefish.scaleX=_fish.scaleX;});
addChildAt(_bluefish,1);
}
private function fish_pos1r():void{Tweener.addTween(_fish, {scaleX:1, x:280, time:0.1, delay:2, transition:"linear", onComplete:fish_pos1});}
private function fish_pos1():void{Tweener.addTween(_fish, {x:120, y:100, time:4, transition:"linear", onComplete:fish_pos2r});}
private function fish_pos2r():void{Tweener.addTween(_fish, {scaleX:-1, x:220, time:0.1, delay:2, transition:"linear", onComplete:fish_pos2});}
private function fish_pos2():void{Tweener.addTween(_fish, {x:320, y:350, rotation:30, time:4, transition:"linear", onComplete:fish_pos3r});}
private function fish_pos3r():void{Tweener.addTween(_fish, {scaleX:-1, time:0.1, delay:4, transition:"linear", onComplete:fish_pos3});}
private function fish_pos3():void{Tweener.addTween(_fish, {x:400, y:250, rotation:0, time:2, transition:"linear", onComplete:fish_pos4r});}
private function fish_pos4r():void{Tweener.addTween(_fish, {scaleX:1, x:280, time:0.1, delay:4, transition:"linear", onComplete:fish_pos4});}//koko
private function fish_pos4():void{Tweener.addTween(_fish, {x:70, y:200, time:4, transition:"linear", onComplete:fish_pos5r});}
private function fish_pos5r():void{Tweener.addTween(_fish, {scaleX:-1, x:200, time:0.1, delay:4, transition:"linear", onComplete:fish_pos5});}//koko
private function fish_pos5():void{Tweener.addTween(_fish, {x:360, y:320, time:4, transition:"linear", onComplete:fish_pos1r});}
private function click_Surprised(ev){
var _impact=new Sprite();
_impact.graphics.lineStyle(1,0xffffff,0.8);
_impact.graphics.drawCircle(-10,-10,20);
_impact.x=mouseX;
_impact.y=mouseY;
addChild(_impact);
Tweener.addTween(_impact, {scaleX:2,scaleY:2 ,alpha:0, time:1, transition:"linear", onComplete:function(ev){removeChild(_impact);_impact=null;}});
if(_fish.scaleX>0){
Tweener.addTween(_fish, {x:70, y:200, time:0.5, transition:"linear", onComplete:fish_pos5r});
}else if(_fish.scaleX==-1){
Tweener.addTween(_fish, {x:360, y:320, time:0.5, transition:"linear", onComplete:fish_pos1r});
}
}
//goldfish///////////////////////////////////////////////////////////////////////////////////////////////////
//
}
}
import flash.display.Sprite;
import flash.display.Shape;
import flash.display.GradientType;
import flash.geom.Matrix;
import flash.events.Event;
class back_ground extends Sprite{
private var arr1:Array=[[0x8CFFEB,0x14708D,0x3FB5C4,0x1699AF],[0xB992A1,0x624156,0xFBA19B,0x4A2D4B],[0xfd826c,0xe33e58,0xfe5c5c,0xf54968],[0xFFD7AB,0xFF5D5B,0xFFB403,0xFD4B03],[0xceea31,0x66aa00,0xB9CE44,0x72aa00]];
private var arr2:Array=[[200,340],[260,340],[180,360],[240,370],[300,360]];
public function back_ground(){
var fishbowl:Sprite=new Sprite();
var gbm:Matrix = new Matrix();
gbm.createGradientBox(970,720,0,-485,-520);
fishbowl.graphics.beginGradientFill(GradientType.RADIAL,[0x8CFFEB,0x3FB5C4,0x14708D,0x1699AF,0x3FB5C4,0x33CCCC,0x1699AF], [1,1,1,1,1,1,1], [0,20,50,80,190,210,225],gbm);
fishbowl.graphics.drawCircle(0,0,180);
fishbowl.graphics.endFill();
fishbowl.x=fishbowl.y=465/2;
addChild(fishbowl);
var fb_s:Sprite=new Sprite();
var gbm1:Matrix = new Matrix();
gbm1.createGradientBox(500,150,0,0,0);
fb_s.graphics.beginGradientFill(GradientType.RADIAL,[0x336699,0x00cccc], [0.85,0], [0,225],gbm1);
fb_s.graphics.drawEllipse(0,0,500,150);
fb_s.graphics.endFill();
fb_s.x=-25;fb_s.y=330;
addChild(fb_s);
for(var j:int=0; j < 5; j++){
var marble:Sprite = new Sprite();
var gbmm:Matrix = new Matrix();
gbmm.createGradientBox(120,120,0,-65,-80);
marble.graphics.beginGradientFill(GradientType.RADIAL,[arr1[j][0],arr1[j][1],arr1[j][2],arr1[j][3]],[1,1,0.8,1], [0,50,180,225],gbmm);
marble.graphics.drawCircle(0,0,30);
marble.graphics.endFill();
marble.alpha=0.95;
marble.x=arr2[j][0];
marble.y=arr2[j][1];
addChild(marble);
var m_s:Sprite=new Sprite();
var _gbm:Matrix = new Matrix();
_gbm.createGradientBox(60,30,0,0,0);
m_s.graphics.beginGradientFill(GradientType.RADIAL,[0x14517B,0x14517B], [0.85,0], [0,225],_gbm);
m_s.graphics.drawEllipse(0,0,60,30);
m_s.graphics.endFill();
m_s.x=-30;m_s.y=15;
marble.addChild(m_s);
}
}
}
class aqua extends Sprite{
public var radius:Number=Math.floor(Math.random()*100)+10;
public var angel:uint=1;
public function aqua(){
this.graphics.lineStyle(1,0xffffff,0.8);
this.graphics.drawCircle(0,0,2);
}
}
class goldfish extends Sprite{
private var body:Sprite=new Sprite();
private var wg1:Sprite=new Sprite();
private var wg2:Sprite=new Sprite();
private var wg3:Sprite=new Sprite();
private var wg4:Sprite=new Sprite();
private var radian:Number = Math.PI/180;
private var speed:uint = 1;
private var wg1_angle:Number =0;
private var wg2_angle:Number =0;
private var wg3_angle:Number =0;
private var wg4_angle:Number =0;
public function goldfish(){
var rot:Number = 2 * Math.PI * (90 / 360);
var gbm1:Matrix = new Matrix();
gbm1.createGradientBox(60, 30, rot, 0, 5);
var gbm2:Matrix = new Matrix();
gbm2.createGradientBox(40, 30, rot, 0, 5);
var sp0:Shape=new Shape();
sp0.graphics.beginFill(0xFD4B03,0.8);
sp0.graphics.drawRoundRect(25,-20,30,20,10);
sp0.rotation=15;
sp0.graphics.endFill();
var sp1:Shape=new Shape();
sp1.graphics.beginGradientFill(GradientType.LINEAR, [ 0xFD4B03,0xFFB403], [1, 1], [0, 180], gbm1);
sp1.graphics.drawEllipse(0,0,60,30);
sp1.graphics.endFill();
var sp2:Shape=new Shape();
sp2.graphics.beginGradientFill(GradientType.LINEAR, [ 0xFD4B03,0xFFB403], [1, 1], [0, 180], gbm2);
sp2.graphics.drawEllipse(20,-3,40,36);
sp2.graphics.endFill();
var sp3:Shape=new Shape();
sp3.graphics.beginFill(0xFD4B03);
sp3.graphics.lineStyle(1,0xFFFF99);
sp3.graphics.drawCircle(10,15,2.5);
sp3.graphics.endFill();
body.addChild(sp0);
body.addChild(sp1);
body.addChild(sp2);
body.addChild(sp3);
addChild(body);
wg1.graphics.beginFill(0xFD4B03,0.5);
wg1.graphics.drawEllipse(0,-6,25,12);
wg1.graphics.endFill();
addChild(wg1);
wg1.x=20;wg1.y=15;
wg2.graphics.beginFill(0xFD4B03,0.5);
wg2.graphics.drawEllipse(0,-6,30,12);
wg2.graphics.endFill();
addChildAt(wg2,0);
wg2.x=40;wg2.y=32;
wg2.rotation=15;
wg3.graphics.beginFill(0xFD4B03,0.8);
wg3.graphics.drawEllipse(0,-6,30,12);
wg3.graphics.endFill();
addChild(wg3);
wg3.x=40;wg3.y=32;
wg3.rotation=45;
var sp10:Shape=new Shape();
sp10.graphics.beginFill(0xFD4B03,0.8);
sp10.graphics.drawEllipse(0,-10,50,20);
sp10.graphics.endFill();
var sp11:Shape=new Shape();
sp11.graphics.beginFill(0xFD4B03,0.8);
sp11.graphics.drawEllipse(0,-10,40,20);
sp11.graphics.endFill();
sp11.rotation=30;
wg4.addChild(sp10);
wg4.addChild(sp11);
addChild(wg4);
wg4.x=60;wg4.y=15;
wg1.addEventListener(Event.ENTER_FRAME, mov_wg1);
wg2.addEventListener(Event.ENTER_FRAME, mov_wg2);
wg3.addEventListener(Event.ENTER_FRAME, mov_wg3);
wg4.addEventListener(Event.ENTER_FRAME, mov_wg4);
}
private function mov_wg1(ev:Event):void{
wg1.rotation= 15 * Math.sin(wg1_angle * radian);
wg1_angle += 2;//speed
}
private function mov_wg2(ev:Event):void{
wg2.rotation= 15 * Math.sin(wg2_angle * radian)+10;
wg2_angle += speed;
}
private function mov_wg3(ev:Event):void{
wg3.rotation= 15 * Math.sin(wg3_angle * radian)+30;
wg3_angle += speed;
}
private function mov_wg4(ev:Event):void{
wg4.rotation= 20 * Math.sin(wg4_angle * radian);
wg4_angle += speed;
}
}