国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
flash as 3.0 時(shí)鐘源代碼
//  文件 1.DTimer.as
package{
import flash.display.Shape;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.text.StaticText;
import flash.events.*;
import flash.text.TextField;
import flash.text.TextFormat;
public class DTimer extends Sprite{
// 設(shè)置時(shí)鐘寬度
public var w:uint=200;
// 設(shè)置時(shí)鐘高度
public var h:uint=200;
// 設(shè)置時(shí)鐘半徑
public var radius:uint;
// 設(shè)置時(shí)鐘中心位置
public var centerX:int;
public var centerY:int;
// 定義三個(gè)形狀表示時(shí)鐘指針
public var hourHand:Shape;
public var minuteHand:Shape;
public var secondHand:Shape;
// 定義時(shí)鐘樣式
public var bgColor:uint=0xeeeeff;
public var hourHandColor:uint=0x003366;
public var minuteHandColor:uint=0x000099;
public var secondHandColor:uint=0xcc0033;
public var x0:uint;
public var y0:uint;
public var x1:uint;
public var y1:uint;
public var txt:TextField;
// 定義時(shí)間
public var currentTime:Date;
public function init():void{
// 繪制表盤
drawBorder();
// 繪制表盤顯示文字
drawLabels();
// 繪制指針
createHands();
Drawlss();
// 顯示文本
CreateTxt();
}
public function DTimer(w:uint){
this.w=w;
this.h=w; // 是圓盤所以取一樣
this.radius=Math.round(this.w/2);
this.centerX=this.radius;
this.centerY=this.radius;
}
public function drawBorder(){
graphics.lineStyle(0.5,0x999999);
graphics.beginFill(bgColor);
graphics.drawCircle(centerX,centerY,radius);
graphics.endFill();
}
public function drawLabels(){
for(var i:Number=1;i<=12;i++){
var label:TextField=new TextField();
label.text=i.toString();
// 小時(shí)位置
var angleInRadians:Number=i*30*(Math.PI/180); 
/*          度*π    
弧度==---------
180
弧度*180
度==------------
π
即:π弧度等于180度
*/
label.x=centerX+(0.9*radius*Math.sin(angleInRadians))-5;
label.y=centerY-(0.9*radius*Math.cos(angleInRadians))-9;
trace(Math.sin(angleInRadians));
// 格式化文本內(nèi)容
var tf:TextFormat=new TextFormat();
tf.font="Arial";
tf.bold="true";
tf.size=12;
label.setTextFormat(tf);
addChild(label);
}
}
// 繪制分鐘對應(yīng)位置
public function Drawlss(){
for(var i:Number=0;i<=60;i++){
var lshape:Shape=new Shape();
Drawls(lshape,i*6,0x000000,1);
addChild(lshape);
}
}
// 繪制分針方法
public function Drawls(hand:Shape,rot:uint,color:uint,thickness:Number):void{
var angleInRadius:Number=rot*(Math.PI/180);
x1=centerX+(radius*Math.sin(angleInRadius));
y1=centerY-(radius*Math.cos(angleInRadius));
if(rot%30==0){
x0=centerX+(0.95*radius*Math.sin(angleInRadius));
y0=centerY-(0.95*radius*Math.cos(angleInRadius));
}else{
x0=centerX+(0.97*radius*Math.sin(angleInRadius));
y0=centerY-(0.97*radius*Math.cos(angleInRadius));
}
hand.graphics.lineStyle(thickness,color);
hand.graphics.moveTo(x0,y0);
hand.graphics.lineTo(x1,y1);
}
public function createHands():void{
var hourHandShape:Shape=new Shape();
drawHand(hourHandShape,Math.round(radius*0.5),hourHandColor,3.0);
this.hourHand=Shape(addChild(hourHandShape));
this.hourHand.x=centerX;
this.hourHand.y=centerY;
// 繪制分針
var minuteHandShape:Shape=new Shape();
drawHand(minuteHandShape,Math.round(radius*0.8),minuteHandColor,2.0);
this.minuteHand=Shape(addChild(minuteHandShape));
this.minuteHand.x=centerX;
this.minuteHand.y=centerY;
// 繪制秒針
var secondHandShape:Shape=new Shape();
drawHand(secondHandShape,Math.round(radius*0.9),secondHandColor,0.5);
this.secondHand=Shape(addChild(secondHandShape));
this.secondHand.x=centerX;
this.secondHand.y=centerY;
}
public function drawHand(hand:Shape,distance:uint,color:uint,thickness:Number):void{
hand.graphics.lineStyle(thickness,color);
hand.graphics.moveTo(0,distance);
hand.graphics.lineTo(0,0);
}
public function draw():void{
currentTime=new Date();
showTime(currentTime);
showT(currentTime);
}
public function CreateTxt():void{
txt=new TextField();
txt.width=300;
txt.x=centerX-radius;
txt.y=centerY-radius-20;
addChild(txt);
}
public function showT(time:Date){
var seconds:uint=time.getSeconds();
var minutes:uint=time.getMinutes();
var hours:uint=time.getHours();
var year:uint=time.getFullYear();
var month:uint=time.getMonth()+1;
var date:uint=time.getDate();
this.txt.text="現(xiàn)在時(shí)間是"+year+"年"+month+"月"+date+"日"+hours+"時(shí)"+minutes+"分"+seconds+"秒";
}
public function showTime(time:Date):void{
var seconds:uint=time.getSeconds();
var minutes:uint=time.getMinutes();
var hours:uint=time.getHours();
this.secondHand.rotation=180+(seconds*6);
this.minuteHand.rotation=180+(minutes*6);
this.hourHand.rotation=180+(hours*30)+(minutes*0.5);
}
}
}

//文件2. SimpleClock.as
package{
import flash.display.Sprite;
import DTimer;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class SimpleClock extends Sprite{
public var face:DTimer;
public var ticker:Timer;
public static const millisecondsPerMinute:int=1000*60;
public static const millisecondsPerHour:int=1000*60*60;
public static const millisecondsPerDay:int=1000*60*60*24;
public function initClock(faceSize:Number=200){
var invoiceDate:Date=new Date();
var millisecondsPerDay:int=1000*60*60*24;
var dueDate:Date =new Date(invoiceDate.getTime()+(30*millisecondsPerDay));
var oneHourFromNow:Date=new Date();
oneHourFromNow.setTime(oneHourFromNow.getTime()+millisecondsPerHour);
// 創(chuàng)建表盤,初始化參數(shù)
face=new DTimer(Math.max(20,faceSize));
face.init();
addChild(face);
face.draw();
// 創(chuàng)建Timer對象
ticker=new Timer(1000);
ticker.addEventListener(TimerEvent.TIMER,onTick);
ticker.start();
}
public function onTick(event:TimerEvent){
face.draw();
}
}
}

// 文件3.DateTimer.as
package{
import flash.display.Sprite;
import DTimer;
import SimpleClock;
public class DateTimer extends Sprite{
public function DateTimer(){
var sc:SimpleClock=new SimpleClock();
sc.x=165;
sc.y=100;
addChild(sc);
sc.initClock();
}
}
}



本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
《每周一點(diǎn)canvas動(dòng)畫》——圓周運(yùn)動(dòng)
Html利用Canvas繪制圖形
Processing.js
三維空間中直角坐標(biāo)與球坐標(biāo)的相互轉(zhuǎn)換
圖像濾鏡處理算法:柔化、光照、放大鏡、哈哈鏡
C++游戲源碼 旋轉(zhuǎn)蛇
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服