flash on 2013-1-24
/**
* Copyright shoko ( http://wonderfl.net/user/shoko )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/whfH
*/
package
{
import a24.tween.Ease24;
import a24.tween.Tween24;
import flash.display.Sprite;
import flash.text.TextField;
public class tokei2 extends Sprite
{
public function tokei2()
{
var ball = new Sprite();
ball.graphics.beginFill(0xffff00);
ball.graphics.drawCircle(250,190,180);
addChild(ball);
var ball = new Sprite();
ball.graphics.beginFill(0xffffff);
ball.graphics.drawRect(245,10,10,50);
addChild(ball)
var ball = new Sprite();
ball.graphics.beginFill(0xffffff);
ball.graphics.drawRect(380,185,50,10);
addChild(ball)
var ball = new Sprite();
ball.graphics.beginFill(0xffffff);
ball.graphics.drawRect(245,320,10,50);
addChild(ball)
var ball = new Sprite();
ball.graphics.beginFill(0xffffff);
ball.graphics.drawRect(70,185,50,10);
addChild(ball)
var ball3 = new Sprite();
ball3.graphics.beginFill(0x0000ff);
ball3.graphics.drawCircle(0,90,20);
ball3.graphics.beginFill(0x0000ff);
ball3.graphics.drawRect(-5,0,10,90);
ball3.graphics.beginFill(0xffffff);
ball3.graphics.drawCircle(0,90,15);
addChild(ball3);
ball3.x = 250;
ball3.y = 190;
var ball2 = new Sprite();
ball2.graphics.beginFill(0x00ff00);
ball2.graphics.drawCircle(0,120,20);
ball2.graphics.beginFill(0x00ff00);
ball2.graphics.drawRect(-5,0,10,120);
ball2.graphics.beginFill(0xffffff);
ball2.graphics.drawCircle(0,120,15);
addChild(ball2);
ball2.x = 250;
ball2.y = 190;
var ball1 = new Sprite();
ball1.graphics.beginFill(0xff0000);
ball1.graphics.drawCircle(0,150,20);
ball1.graphics.beginFill(0xff0000);
ball1.graphics.drawRect(-2.5,0,5,150);
ball1.graphics.beginFill(0xffffff);
ball1.graphics.drawCircle(0,150,15);
addChild(ball1);
ball1.x = 250;
ball1.y = 190;
var ball = new Sprite();
ball.graphics.beginFill(0x000000);
ball.graphics.drawCircle(250,190,10);
addChild(ball);
var tfhour = new TextField();
addChild(tfhour)
tfhour.text = "時";
tfhour.x = 250;
tfhour.y = 320;
var tfmin = new TextField();
addChild(tfmin)
tfmin.text = "分";
tfmin.x = 250;
tfmin.y = 320;
var tfsec = new TextField();
addChild(tfsec)
tfsec.text = "秒";
tfsec.x = 250;
tfsec.y = 320;
addEventListener("enterFrame", function(){
var now = new Date();
var hour = now.getHours();
var min = now.getMinutes();
var sec = now.getSeconds();
//ball1.x = hour * 5;
//ball2.x = min * 5;
//ball3.x = sec * 5;
ball1.rotation = sec*6 + 180;
//Tween24.tween(ball1,1,Ease24._BackOut).rotation(6).play();
//ball2.x = 100 + 120*Math.cos(2*3.1416*(min/60 + sec/3600) - 3.1416/2);
//ball2.y = 100 + 120*Math.sin(2*3.1416*(min/60 + sec/3600) - 3.1416/2);
ball2.rotation = min*6 + sec*0.1 + 180;
//ball3.x = 100 + 90*Math.cos(2*3.1416*(hour/12 + min/720) - 3.1416/2);
//ball3.y = 100 + 90*Math.sin(2*3.1416*(hour/12 + min/720) - 3.1416/2);
ball3.rotation = hour*30 + min*0.5 + 180;
tfhour.x = 237 + 90*Math.cos(2*3.1416*(hour/12 + min/720) - 3.1416/2);
tfhour.y = 180 + 90*Math.sin(2*3.1416*(hour/12 + min/720) - 3.1416/2);
tfhour.text = hour + "時"
tfmin.x = 237 + 120*Math.cos(2*3.1416*(min/60 + sec/3600) - 3.1416/2);
tfmin.y = 180 + 120*Math.sin(2*3.1416*(min/60 + sec/3600) - 3.1416/2);
tfmin.text = min + "分"
tfsec.x = 237 + 150*Math.cos(2*3.1416*sec/60 - 3.1416/2);
tfsec.y = 180 + 150*Math.sin(2*3.1416*sec/60 - 3.1416/2);
tfsec.text = sec + "秒"
}
);
//addEventListener("click", function(){
//ball.x = ball.x + 100;
//});
}
}
}