点击这里给我发消息 点击这里给我发消息
首页 > 行业资讯 > flash>详细内容

用AS语句制作艺术时钟

添加时间:2013-12-6
    相关阅读: 软件 制作
 

制作步骤

1.启动FLASH8 软件。

2.确立文档属性 设置动画尺寸为200*220,帧频为12,背景颜色任意,其它默认,点击确定。如图1所示:

(图1)

3.在场景添加两个图层,共三个图层,自下而上分别命名为“背景”、“文本”和“as”。点击背景图层第一帧,导入一张你喜欢的图片,宽高为200*220,全居中,上锁。如图2所示:

(图2)

4.点击文本图层第一帧,选择文本工具在图片下方输入时钟名称,字体颜色自定。上锁。如图3所示:

 

(图3)

4.点击AS图层第一帧,打开动作面板输入下面语句:
 
//画钟表边线
this.createEmptyMovieClip("bianxian_mc", 1);
with (bianxian_mc) {
lineStyle(2, 0xCCCCCC);
moveTo(Math.cos(0*Math.PI/180)*96, Math.sin(0*Math.PI/180)*96);
for (var i = 360; i>=0; i--) {
lineTo(Math.cos(i*Math.PI/180)*96, Math.sin(i*Math.PI/180)*96);
}
_x = 100;
_y = 110;
}
//创建时间动态文本
this.createTextField("my_txt", 2, 0, 0, 0, 0);
with (my_txt) {
autoSize = true;
textColor = 0x555555;
_x = 70;
_y = 60;
}
//画12个表格
this.createEmptyMovieClip("biaoge_mc", 3);
with (biaoge_mc) {
lineStyle(2, 0xCCCCCC);
moveTo(0, -96);
lineTo(0, -92);
_x = 100;
_y = 110;
}
for (i=1; i<12; i++) {
duplicateMovieClip(biaoge_mc, "biaoge_mc"+i, 3+i);
setProperty("biaoge_mc"+i, _rotation, i*30);
}
//画时针
this.createEmptyMovieClip("shizhen_mc", 16);
with (shizhen_mc) {
lineStyle(4, 0x666666);
moveTo(0, 0);
lineTo(0, -60);
_x = 100;
_y = 110;
}
//画分针
this.createEmptyMovieClip("fenzhen_mc", 17);
with (fenzhen_mc) {
lineStyle(2, 0x666666);
moveTo(0, 0);
lineTo(0, -75);
_x = 100;
_y = 110;
}
//画秒针
this.createEmptyMovieClip("miaozhen_mc", 18);
with (miaozhen_mc) {
lineStyle(1, 0x666666);
moveTo(0, 0);
lineTo(0, -90);
_x = 100;
_y = 110;
}
//让时针、分针、秒针动起来
this.createEmptyMovieClip("time_mc", 19);
time_mc.onEnterFrame = function() {
my_date = new Date();
shi = my_date.getHours();
fen = my_date.getMinutes();
miao = my_date.getSeconds();
shizhen_mc._rotation = shi/12*360+fen/60*30;
fenzhen_mc._rotation = fen/60*360+miao/60*6;
miaozhen_mc._rotation = miao/60*360;
if (shi<10) {
shi = "0"+shi;
}
if (fen<10) {
fen = "0"+fen;
}
if (miao<10) {
miao = "0"+miao;
}
my_txt.text = shi+":"+fen+":"+miao;
};
//画中心圆
this.createEmptyMovieClip("yuan_mc", 20);
with (yuan_mc) {
beginFill(0x555555);
moveTo(Math.cos(0*Math.PI/180)*4, Math.sin(0*Math.PI/180)*4);
for (var i = 360; i>=0; i--) {
lineTo(Math.cos(i*Math.PI/180)*4, Math.sin(i*Math.PI/180)*4);
}
_x = 100;
_y = 110;
}  

5.时间轴面板如图4所示:

图4

6.测试存盘

说明:你可以在最上层添加一个图层,为钟表加上漂亮的外壳:如果你想显示背景和钟表一样是圆形,那你可以在背景之上添加一个遮罩层或一个空心圆的边框。

 

咨询热线:020-85648757 85648755 85648616 0755-27912581 客服:020-85648756 0755-27912581 业务传真:020-32579052
广州市网景网络科技有限公司 Copyright◎2003-2008 Veelink.com. All Rights Reserved.
广州商务地址:广东省广州市黄埔大道中203号(海景园区)海景花园C栋501室
= 深圳商务地址:深圳市宝源路华丰宝源大厦606
研发中心:广东广州市天河软件园海景园区 粤ICP备05103322号 工商注册