日历
| |||||||||
| 日 | 一 | 二 | 三 | 四 | 五 | 六 | |||
| 1 | 2 | 3 | 4 | 5 | |||||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 | |||
| 13 | 14 | 15 | 16 | 17 | 18 | 19 | |||
| 20 | 21 | 22 | 23 | 24 | 25 | 26 | |||
| 27 | 28 | 29 | 30 | 31 | |||||
搜索标题
最新评论
统计信息
- 访问量: 1782
- 日志数: 7
- flash数: 1
- 建立时间: 2008-01-04
- 更新时间: 2008-06-11
我的最新日志
-
草根站长必备的心理素质
2008-6-11
现在有很多的草根站长,自己开一个网站,理由有很多。有的想玩玩,纯粹为了兴趣;有的把他当事业来做;有的为了做点;有的为了实践或者学习seo等等。但是不管怎么说,作为一个站长,至少是草根级别的,下面的心态是必须要的。
一、耐心
google,百度,yahoo收录你要等待,你优化关键字要等待,各种seo的效果不是立马就能显现出来的,可能有的要等到一两个月。百度哪天看你不爽了,k你了,你修理了你的网站,申请重新登陆,还是等待。哪天你等不下去,也就放弃了。你的耐心就是生存力。
二、永远保持平静的心态
当你的网站某一个关键字,排第一名的时候,不用那么高兴,说不定一个礼拜后就下去了,当你的排名一直不前时候,也不用不开心,以为这个排名可以靠你的能力,你的优化来提上去的。当然,不要和那些大网站和竞价排名的那些去比。这种做到第一名的可能性基本不存在
三、虚心
一定要好好的学习别人网站的优化,慧聪网一个seo大师优化的,虽然有很多地方我不知道他优化在哪些地方!还有据说sina的优化做的非常到位!可以模仿人家的模板,做的好的模板,然后改关键字,改图片,布局也稍微改改,查下相似度,很低就没有问题!虽然是个流氓办法,但是很实用
四、务实的心态
做网站,一步步来。别投机取巧,做贴吧发帖机,或者买ip流量(虽然很便宜),或者用链接站,或者用工具网别人网站里面加代码增加外链,放心,必死!就是时间问题
五、善心
做网站要对得起自己的良心。**别搞,病毒网站别搞,反动网站也别搞!网站里面内容多点,页面不要都是广告,内容要找!我觉得我还算有良心,至少做的软件下载都是免费的,都是自己用过的!比如说skype,我本来就一直在用的,IM功能强悍,视频不卡,还能开语音会议!打电话而且便宜!而想wps2008还有金山毒霸2008,我本来自己也在用,觉得也还行!没有必要自己觉得不好,还推广,反过来被人骂 -
网站中英对照查询
2008-6-11
是个做网站的,现在大部分的企业网站都要求做中英双语了,走向国际化。呵呵。提供一些企业网站常用中英文对照表,希望对大家有所帮助。
网站导航 site map公司简介 PROFILE or COMPANY Profile or Company
公司设备 EQUIPMENT Equipment
公司荣誉 GLORIES Glories
企业文化 CULTURE Culture
产品展示 PRODUCT Product
资质认证 quality certification
企业规模 SCALE Scale
营销网络 Sales Network
组织机构 orGANIZATION organization
合作加盟 Join in Cooperation
技术力量 TECHNOLOGY Technology
经理致辞 Manager`s oration
发展历程 Development history
工程案例 Engineering Projects
业务范围 Business Scope
分支机构 Branches
供求信息 Supply & Demand
经营理念 Operation Principle
产品销售 SALES Sales
联系我们 CONTACT US Contact Us
信息发布 INFORMATION Information
返回首页 HOMEPAGE Homepage
产品定购 orDER order
分类浏览 Browse by category
电子商务 E-Business
公司实力 STRENGTH Strength
版权所有 Copy right
友情连结 Hot link
应用领域 Application Fields
人力资源 Human Resource HR
领导致辞 Leader`s oration
企业资质 Enterprise qualification
行业新闻 Trade news
行业动态 Trends
客户留言 Customer Message
客户服务 Customer Service
新闻动态 News & Trends
公司名称 Company Name
销售热线 Sales Hot-line
联系人 Contact Person
您的要求 Your requirements
建设中 In construction
证书 CERTIFICATE Certificate
地址 ADD Add
邮编 POSTAL CODE Zipcode
电话 TEL Tel
传真 FAX Fax
产品名称 Product Name
产品说明 DEscrīptION Descrīption
价格 Price
品牌 Brand
规格 Specification
尺寸 Size
生产厂家 MANUFACUTURER Manufacturer
型号 Model
产品标号 Item No.
技术指标 Technique Data
产品描述 Descrīption
产地 Production Place
销售信息 Sales Information
用途 Application
论坛 Forum
在线订购 On-line order
招商 Enterprise-establishing
招标 Bid inviting
综述 General
业绩 Achievements
招聘 Join Us
求贤纳士 Join Us
大事 Great Event
动态 Trends
服务 Service
投资 Investment
行业 Industry
规划 Programming
环境 Environment
发送 Delivery
提交 Submit
重写 Reset
登录 Enter
注册 Login
中国企业网技术支持 Powered by ce.net.cn
社区 Community
业务介绍 Business introduction
在线调查 Online inquiry Inquiry
下载中心 Download
会员登陆 Member Entrance
意见反馈 Feedback
常见问题 FAQ
中心概况 General Profile
教育培训 Education & Training
游乐园 amusement park
在线交流 Online communication
专题报道 Special report
-
十几种Flash游戏开发常用代码汇集
2008-6-10
[来源:闪无忧 | 作者:佚名 | 时间:2008-04-25 | 点击: 74 | 收藏本文 【大 中 小】]
对象数组
比如要构建一个有很多属性的数组,简单的可以这样做:
2004 代码:
var a:Array = new Array();
for (var i = 0; i<10; i++) {
a[i] = new Object();
a[i].x = 10;
a[i].y = 10*i;
a[i].name = "---";
a[i].id = i;
// 随便你给什么属性啊。
}
////先用局部变量存储对象会更好一点。
var a=new Array()
for(var i=0;i<10;i++){
var ta=new Object();
ta.x=10;
ta.y=10;
ta.name="n"+i;
a.push(ta);
}
////或者更简便一点的方法:
var a=new Array()
for(var i=0;i<10;i++){
a[i]={x:10,y:10,name:"n"+i}
}
程序控制角色运动
下面这段代码控制 MovieClip mc 从 (50,50) 横向运动到(100,50) 停止,速度为 5 pixel:
mc._x = mc._y=50;
mc.onEnterFrame = function() {
_x += 5;
trace(_x);
if (_x == 100) {
delete (mc.onEnterFrame);
}
};
精确计时
我们设定了时间为 60 秒,然后通过 setInterval 来定期(每1000milliseconds)触发一个函数 runTimer。
function runTimer 用来计时,当时间到了以后,转去执行 outThere。
function outThere 用来处理时间到了以后的动作,不要忘记 clearInterval(intervalID),停止计时。
var time:Number = 60;
var intervalID:Number;
intervalID = setInterval(runTimer, 1000);
function runTimer() {
time--;
trace(time);
if (time == 0) {
outThere();
}
}
function outThere() {
// blah blah blah
clearInterval(intervalID);
}
找到目前最小的一个可用的深度 Depth(来自国外)
针对 Flash Player 6 的:
availTopDepth = function () {
var allDepths = [];
for (var z in _root) {
if (_root[z] instanceof Button || _root[z] instanceof MovieClip || _root[z] instanceof TextField) {
allDepths.push(_root[z].getDepth());
}
}
if (allDepths.length != 0) {
sortAll = function (a, b) { if (ab) {return 1;} else {return 0;}};
allDepths.sort(sortAll);
return (parseInt(allDepths[allDepths.length-1])+1);
}
};
trace(_root.availTopDepth());
放置一个 MovieClip 在 Stage,再执行这段 Action 就会得到最近的一个可用深度。我们也可以用这个来创建绝对不会出问题的 MovieClip,比如:
_root.createEmptyMovieClip("mc_name", availTopDepth());
getNextHighestDepth() 以及 getInstanceAtDepth(depth)是 for player 7 的。
鼠标消隐
鼠标消隐之后,右健弹出菜单,鼠标就又出现了,并且一直保留着~
完整的解决方法是:在 左健抬起、右健第二次抬起、回车键抬起的时候再次消隐鼠标。
完整的方法比较复杂,下面是一个简单的解决方法,可以解决绝大多数的问题:
onEnterFrame=function(){
if(Key.isDown(1)|| Key.isDown(Key.ENTER)){
Mouse.hide();
}
}
我常用的一个加速度移动的代码
//以下代码放到主场景第一帧
stop();
_global.a = 5;
//移动加速度,越大越慢
_global.click_x = 0;
//用来记录点击鼠标的位置
_global.click_y = 0;
_root.onMouseDown = function() {
_global.click_x = _root._xmouse;
_global.click_y = _root._ymouse;
//me是受控mc的instance name
me.onEnterFrame = function() {
if (Math.abs(_global.click_x-me._x)<2 && Math.abs(_global.click_y-me._y)<2) {
//如果已经基本移到了鼠标点过的位置就取消这个事件句柄的响应程序
delete (this.onEnterFrame);
return;
} else {
//控制移动
me._x += (_global.click_x-me._x)/_global.a;
me._y += (_global.click_y-me._y)/_global.a;
}
};
};
//////以下部分可选
//a_v是个可以输入的文本框,用来输入加速度,即可以自定义速度,方便调试
a_v.onChanged = function() {
if (a_v.text == "" || Number(a_v.text)>1000 || Number(a_v.text)<0) {
//default value
a_v.text = 5;
} else {
_global.a = Number(a_v.text) ? Number(a_v.text) : 5;
//trace(_global.a);
}
};
随机输出1到100而不从复的语句~~~
seq = new Array(100);
pArray = new Array(100);
function makeRandom() {
for (i=1; i<=100; i++) {
seq[i] = "A";
}
}
function mRandom() {
while (true) {
n = int(random(100))+1;
if (seq[n] == "A") {
seq[n] = "0";
break;
}
}
return (n);
}
function rArray() {
for (i=1; i<=100; i++) {
pArray[i] = mRandom();
trace(pArray[i]);
}
}
stop();
偷梁换柱~~~
我们可以用这样一个技巧,在某些函数外部加一些东西而不需要了解函数的代码~~
比如,假如当前有很多mc 覆盖了onEnterFrame函数,我们可以这样了解那些在_root下的mc 的onEnterFrame函数是以什么顺序执行的:
代码:
for(var i in _root){
if(_root[i].onEnterFrame != null){//如果这个Object实现了onEnterFrame接口的话
_root[i].oldFunc = _root[i].onEnterFrame;//首先保存原来的onEnterFrame的句柄
_root[i].onEnterFrame = function(){//然后开始替换了~~加上一层壳~~
trace(this+ ": onEnterFrame Called.");
this.oldFunc();//我们用保留的句柄调用原来的函数
trace(this+ ": onEnterFrame Returned.");
}
}
}
如果要取消这些附加的操作:
代码:
for(var i in _root){
if(_root[i].oldFunc!= null){//如果发现改过得痕迹
_root[i].onEnterFrame = _root[i].oldFunc;
delete(oldFunc);
}
}
呵呵这些操作的关键在于 flash里面的引用机制:
所有函数名都是引用,而函数本身是浮在数据的海洋里面的。如果没有任何变量引用他,他就会被回收。如果有,他就不会被回收。所以有着样一个有趣的事情:delete函数不会删掉任何东西,除了要求删掉的那个名字:(和java
机制相似,而和C不同)
a= function(){trace("Function a called");}
b=a;
delete(a);//除了a这个名字被删掉以外,没有任何事情发生
b();
函数通过this得到其调用者的实例。
MovieClipPlus.as
定义了一些简单的MC操作
//画点:由于flash没有画点,那我们就画短线
MovieClip.prototype.point = OxMovieClipPoint;
function OxMovieClipPoint(x, y) {
this.moveTo(x, y);
this.lineTo(x+1, y);
}
//画矩形,左上角x1,y1 右下角x2,y2, 颜色rgb, 不透明度alpha
MovieClip.prototype.rect = OxMovieClipRect;
function OxMovieClipRect(x1, y1, x2, y2, rgb, alpha) {
this.beginFill(rgb, alpha);
this.moveTo(x1, y1);
this.lineTo(x1, y2);
this.lineTo(x2, y2);
this.lineTo(x2, y1);
this.lineTo(x1, y1);
this.endFill();
}
//画圆:这么bt的冬冬当然不是我写的,作者素Jody Keating
//圆心x,y ,半径r
MovieClip.prototype.circle = OxMovieClipCircle;
function OxMovieClipCircle(x, y, r) {
var a = r*0.414213562;
var b = r*0.707106781;
this.moveTo(x+r, y);
this.curveTo(x+r, y-a, x+b, y-b);
this.curveTo(x+a, y-r, x, y-r);
this.curveTo(x-a, y-r, x-b, y-b);
this.curveTo(x-r, y-a, x-r, y);
this.curveTo(x-r, y+a, x-b, y+b);
this.curveTo(x-a, y+r, x, y+r);
this.curveTo(x+a, y+r, x+b, y+b);
this.curveTo(x+r, y+a, x+r, y);
}
两点间的直线移动
var s = 15;
_root.onMouseDown = function() {
var oldM_x = _root._xmouse;
var oldM_y = _root._ymouse;
ax = aa._x;
ay = aa._y;
dis = Math.sqrt((oldM_x-ax)*(oldM_x-ax)+(oldM_y-ay)*(oldM_y-ay));
xa = (oldM_x-ax)/dis;
ya = (oldM_y-ay)/dis;
amove();
};
function amove() {
onEnterFrame = function () {
aa._x += s*xa;
aa._y += s*ya;
if (Math.sqrt((aa._x-ax)*(aa._x-ax)+(aa._y-ay)*(aa._y-ay))>dis) {
delete onEnterFrame;
}
};
}
计算两个对象之间/两点之间的距离(注册点)
function getDistanceOf(target1, target2, x2, y2) {
if (arguments.length == 4) {
dx = x2-target1;
dy = y2-target2;
} else if (arguments.length == 2) {
dx = target2._x-target1._x;
dy = target2._y-target1._y;
}
return Math.sqrt(dx*dx+dy*dy);
}
//Arguments 对象是一个数组,其中包含作为参数传递给任何函数的值。每次在动作脚本中调用函数时,都会为该函数自动创建 Arguments 对象。同时还会创建一个局部变量 arguments,使您可引用 arguments 对象。
让播放的MC暂停一段时间
function pausePlay(sec) {
pfunc = function () {
this.play();
clearInterval(this.pint);
}
stop();
this.pint = setInterval(this, "pfunc", sec*1000);
}
//这样调用.sec是暂停的时间,单位是秒.
pausePlay(2);
onHitTest(target),自己写的一个MC事件,当该MC与指定的MC hitTest的时候触发事件.其实也没什么特别的地方,一样也是用setInterval来实现
stop();
MovieClip.prototype.listen = function(target) {
if (this.isHiting == undefined) {
this.isHiting = this.hitTest(target);
}
if (this.hitTest(target)) {
if (this.isHiting == false) {
this.broadcastMessage("onHitTest", this, target);//广播事件,给事件传递this和target两个参数
}
this.isHiting = true;
} else {
this.isHiting = false;
}
};//为MovieClip添加域成员listen成员,用于监视当前对象与目标是否碰撞
MovieClip.prototype.watch = function(target) {
this.timer = setInterval(this, "listen", 50, target);
};//以每50毫秒检测一次的速度来检测是否碰撞
MovieClip.prototype.unWatch = function() {
clearInterval(this.timer);
};//停止对对象的监视
ASBroadcaster.initialize(MovieClip.prototype);//初始化MovieClip原型为事件源//下面是调用的示例
//假设有两个MovieClip,左边ball,右边wall,让ball不断往wall移动,同时监视wall,一旦击中触发事件onHitTest
ball.onEnterFrame = function() {
this._x += 5;
};//让ball不断往右方移动工
myListener = new Object();
myListener.onHitTest = function(source,target){
trace("The " + source._name + " hit " + target._name + ".");
};
ball.addListener(myListener);//创建监听员并注册给ball
ball.watch(wall);//让ball监视wall
MD5 32位码的FLASH算法
//-----------
function md5(s) {
return binl2hex(core_md5(str2binl(s), s.length*strsize));
}
function core_md5(x, len) {
x[len >> 5] = (x[len >> 5]) | (128 << len%32);
x[(((len+64) >>> 9) << 4)+14] = len;
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
var i = 0;
while (i var ōlda = a;
var ōldb = b;
var ōldc = c;
var ōldd = d;
a = md5_ff(a, b, c, d, x[i+0], 7, -680876936);
d = md5_ff(d, a, b, c, x[i+1], 12, -389564586);
c = md5_ff(c, d, a, b, x[i+2], 17, 606105819);
b = md5_ff(b, c, d, a, x[i+3], 22, -1044525330);
a = md5_ff(a, b, c, d, x[i+4], 7, -176418897);
d = md5_ff(d, a, b, c, x[i+5], 12, 1200080426);
c = md5_ff(c, d, a, b, x[i+6], 17, -1473231341);
b = md5_ff(b, c, d, a, x[i+7], 22, -45705983);
a = md5_ff(a, b, c, d, x[i+8], 7, 1770035416);
d = md5_ff(d, a, b, c, x[i+9], 12, -1958414417);
c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
a = md5_ff(a, b, c, d, x[i+12], 7, 1804603682);
d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329);
a = md5_gg(a, b, c, d, x[i+1], 5, -165796510);
d = md5_gg(d, a, b, c, x[i+6], 9, -1069501632);
c = md5_gg(c, d, a, b, x[i+11], 14, 643717713);
b = md5_gg(b, c, d, a, x[i+0], 20, -373897302);
a = md5_gg(a, b, c, d, x[i+5], 5, -701558691);
d = md5_gg(d, a, b, c, x[i+10], 9, 38016083);
c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
b = md5_gg(b, c, d, a, x[i+4], 20, -405537848);
a = md5_gg(a, b, c, d, x[i+9], 5, 568446438);
d = md5_gg(d, a, b, c, x[i+14], 9, -1019803690);
c = md5_gg(c, d, a, b, x[i+3], 14, -187363961);
b = md5_gg(b, c, d, a, x[i+8], 20, 1163531501);
a = md5_gg(a, b, c, d, x[i+13], 5, -1444681467);
d = md5_gg(d, a, b, c, x[i+2], 9, -51403784);
c = md5_gg(c, d, a, b, x[i+7], 14, 1735328473);
b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);
a = md5_hh(a, b, c, d, x[i+5], 4, -378558);
d = md5_hh(d, a, b, c, x[i+8], 11, -2022574463);
c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562);
b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
a = md5_hh(a, b, c, d, x[i+1], 4, -1530992060);
d = md5_hh(d, a, b, c, x[i+4], 11, 1272893353);
c = md5_hh(c, d, a, b, x[i+7], 16, -155497632);
b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
a = md5_hh(a, b, c, d, x[i+13], 4, 681279174);
d = md5_hh(d, a, b, c, x[i+0], 11, -358537222);
c = md5_hh(c, d, a, b, x[i+3], 16, -722521979);
b = md5_hh(b, c, d, a, x[i+6], 23, 76029189);
a = md5_hh(a, b, c, d, x[i+9], 4, -640364487);
d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
c = md5_hh(c, d, a, b, x[i+15], 16, 530742520);
b = md5_hh(b, c, d, a, x[i+2], 23, -995338651);
a = md5_ii(a, b, c, d, x[i+0], 6, -198630844);
d = md5_ii(d, a, b, c, x[i+7], 10, 1126891415);
c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
b = md5_ii(b, c, d, a, x[i+5], 21, -57434055);
a = md5_ii(a, b, c, d, x[i+12], 6, 1700485571);
d = md5_ii(d, a, b, c, x[i+3], 10, -1894986606);
c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
b = md5_ii(b, c, d, a, x[i+1], 21, -2054922799);
a = md5_ii(a, b, c, d, x[i+8], 6, 1873313359);
d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
c = md5_ii(c, d, a, b, x[i+6], 15, -1560198380);
b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649);
a = md5_ii(a, b, c, d, x[i+4], 6, -145523070);
d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
c = md5_ii(c, d, a, b, x[i+2], 15, 718787259);
b = md5_ii(b, c, d, a, x[i+9], 21, -343485551);
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
i = i+16;
}
return Array(a, b, c, d);
}
function md5_cmn(q, a, b, x, s, t) {
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b);
}
function md5_ff(a, b, c, d, x, s, t) {
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t) {
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t) {
return md5_cmn((b ^ c) ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t) {
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}
function safe_add(x, y) {
var lsw = (x & 65535)+(y & 65535);
var msw = ((x >> 16)+(y >> 16))+(lsw >> 16);
return (msw << 16) | (lsw & 65535);
}
function bit_rol(num, cnt) {
return (num << cnt) | (num >>> (32-cnt));
}
function str2binl(str) {
var bin = Array();
var mask = (1 << strsize)-1;
var i = 0;
while (i<(str.length*strsize)) {
bin[i >> 5] = (bin[i >> 5]) | ((str.charCodeAt(i/strsize) & mask) << i%32);
i = i+strsize;
}
return bin;
}
function binl2hex(binarray) {
if (hexcase) {
} else {
}
var hex_tab = "0123456789abcdef";
var str = "";
var i = 0;
while (i<(binarray.length*4)) {
str = str+(hex_tab.charAt(((binarray[i >> 2]) >> ((i%4*8)+4)) & 15)+hex_tab.charAt(((binarray[i>> 2]) >> (i%4*8)) & 15));
i++;
}
return str;
}
var hexcase = 0;
var strsize = 8;
//--------以上不用修改,
b = md5("xx");
//xx可设为任意字符
s = b.toUpperCase();
//转换成大写
trace(b);
trace(s);
发点缓动函数
Math.linearTween = function(t, b, c, d) {
return c*t/d+b;
};
//线性运动函数
Math.easeInQuad = function(t, b, c, d) {
return c*(t /= d)*t+b;
};
//二次缓入函数
Math.easeOutQuad = function(t, b, c, d) {
return -c*(t /= d)*(t-2)+b;
};
//二次缓出函数
Math.easeINOutQuad = function(t, b, c, d) {
if ((t /= d/2)<1) {
return c/2*t*t+b;
}
return -c/2*((--t)*(t-2)-1)+b;
};
//二次缓入缓出函数
Math.easeInCubic = function(t, b, c, d) {
return c*Math.pow(t/d, 3)+b;
};
//三次缓入函数
Math.easeOutCubic = function(t, b, c, d) {
return c*(Math.pow(t/d-1, 3)+1)+b;
};
//三次缓出函数
Math.easeINOutCubic = function(t, b, c, d) {
if ((t /= d/2)<1) {
return c/2*Math.pow(t, 3)+b;
}
return c/2*(Math.pow(t-2, 3)+2)+b;
};
//三次缓入缓出函数
Math.easeInQuart = function(t, b, c, d) {
return c*Math.pow(t/d, 4)+b;
};
//四次缓入函数
Math.easeOutQuart = function(t, b, c, d) {
return -c*(Math.pow(t/d-1, 4)-1)+b;
};
//四次缓出函数
Math.easeINOutQuart = function(t, b, c, d) {
if ((t /= d/2)<1) {
return c/2*Math.pow(t, 4)+b;
}
return -c/2*(Math.pow(t-2, 4)-2)+b;
};
//四次缓入缓出函数
Math.easeInQuint = function(t, b, c, d) {
return c*Math.pow(t/d, 5)+b;
};
//五次缓入函数
Math.easeOutQuint = function(t, b, c, d) {
return c*(Math.pow(t/d-1, 5)+1)+b;
};
//五次缓出函数
Math.easeINOutQuint = function(t, b, c, d) {
if ((t /= d/2)<1) {
return c/2*Math.pow(t, 5)+b;
}
return c/2*(Math.pow(t-2, 5)+2)+b;
};
//五次缓入缓出函数
Math.easeInSine = function(t, b, c, d) {
return c*(1-Math.cos(t/d*(Math.PI/2)))+b;
};
//正弦缓出函数
Math.easeOutSine = function(t, b, c, d) {
return c*Math.sin(t/d*(Math.PI/2))+b;
};
//正弦缓出函数
Math.easeINOutSine = function(t, b, c, d) {
return c/2*(1-Math.cos(Math.PI*t/d))+b;
};
//正弦缓入缓出函数
Math.easeInExpo = function(t, b, c, d) {
return c*Math.pow(2, 10*(t/d-1))+b;
};
//指数缓入函数
Math.easeOutExpo = function(t, b, c, d) {
return c*(-Math.pow(2, -10*t/d)+1)+b;
};
//指数缓出函数
Math.easeINOutExpo = function(t, b, c, d) {
if ((t /= d/2)<1) {
return c/2*Math.pow(2, 10*(t-1))+b;
}
return c/2*(-Math.pow(2, -10*--t)+2)+b;
};
//指数缓入缓出函数
Math.easeInCirc = function(t, b, c, d) {
return c*(1-Math.sqrt(1-(t /= d)*t))+b;
};
//圆形缓入函数
Math.easeOutCirc = function(t, b, c, d) {
return c*Math.sqrt(1-(t=t/d-1)*t)+b;
};
//圆形缓出函数
Math.easeINOutCirc = function(t, b, c, d) {
if ((t /= d/2)<1) {
return c/2*(1-Math.sqrt(1-t*t))+b;
}
return c/2*(Math.sqrt(1-(t -= 2)*t)+1)+b;
};
//圆形缓入缓出函数 -
从女人的乳房和乳罩谈网站发展
2008-6-09
女人的乳房做为女人的第二性器官,一直在吸引异性方面充当主力军的角色。这一方面是因为乳房的曲线美符合审美标准,另一方面相对第一性器官,位置更加得天独厚,有利于吸引异性的目光。于是乎,在“女人还是挺美”、“没什么大不了的”等口号的号召下,全世界的女人都奋不顾身地投入到让乳房变“挺”、变“大”的运动中来。由于受自身条件所限,后来又发明了隆胸术、乳罩等辅助手段。
有次在街上就碰到一个美女,其乳房之挺之大让人立马就想入非非。于是马上过去搭话、要电话,后来又吃饭、买衣服。。。,终于搞到了床上,战战兢兢的把乳罩解开,心里马上就凉了半截。为啥?那乳罩的厚度绝对不亚于乳房的高度。于是匆匆完事,从此各奔东西。
其实做网站又何尝不是如此。
有些网站定位准、技术好、创意新,比如google,这些网站只要坚持自己的方向,总有一天会取得成功。就像某些女人天生丽质,想不被男人喜欢都难。
有些网站虽然概念陈旧、技术一般,比如淘宝,可是人家有钱宣传、做广告,这些网站也能取得一定的成绩。这就像有些女人做隆胸手术,总会有些人喜欢的。
还有些网站不仅概念错误、技术低下,也没有钱,比如现在的博客网,那怎么办?炒做概念。只要把概念炒做起来,也是很吸引人的。这就像有些女人买加厚的乳罩,只要不到最后时刻,总是能蒙些饭钱、衣服钱的。
-
Div+css的图片缩放
2008-5-29
收录一段Div+css的图片缩放代码
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用滚轮实现图片缩放</title>
</head>
<scrīpt language="Javascrīpt">
function zoomimg(img){
//img.style.zoom获取img对象的缩放比例,并转为十进制整数
var zoom = parseInt(img.style.zoom,10);
if (isNaN(zoom)){ //当zoom非数字时zoom默认为100%
zoom = 100;
}
//event.wheelDelta滚轮移动量上移+120,下移-120;显示比例每次增减10%
zoom += event.wheelDelta / 12;
//当zoom大于10%时重新设置显示比例
if (zoom>10) img.style.zoom = zoom + "%";
}
</scrīpt>
<body>
<br>
<!--onmousewheel:当滚轮移动时触发-->
<img src="001.gif" ōnmousewheel="zoomimg(this)">
</body>
</html> -
用AS实现右键菜单
2008-4-08
经常看到Flash的右键菜单中只显示了很少的几个菜单项,那么这个是怎么做到的呢!?其实实现这个效果并不难,只要用几句AS就能搞定了!
第一种写法:
var my_cm:ContextMenu = new ContextMenu();//新建一个菜单对象
my_cm.hideBuiltInItems();//新建一个菜单对象的内容隐藏
my_cm.builtInItems.print = true;//如果你想要某个或某几个出现,可以这样设置,这里设置的仅显示"打印"
this.menu = my_cm;//将菜单附加到对象第二种写法:
var my_cm:ContextMenu = new ContextMenu();//新建一个菜单对象
my_cm.builtInItems.print = false;//要删除的菜单项设置为false
my_cm.builtInItems.quality=false;
my_cm.builtInItems.zoom=false;
my_cm.builtInItems.forward_back=false;
this.menu = my_cm;//将菜单附加到对象下面是可控制的菜单项目:
zoom:缩放
quality:显示质量
play:播放
loop:循环
rewind:后退
forward_back:快进/返回
print:打印用AS实现右键菜单的最简单方法
作者:闪电儿 类型:转载 来源:网页教学网
非常简单的代码,把下面代码直接放到新建立的Flash的第一帧。var linkURL="http://www.zcsky.com";
var linkText="连接到我的网站";
//定义一个新的右键菜单项
var myMenu = new ContextMenu();
function goToThisURL(){
//定义连接的打开方式
getURL(linkURL, "_blank");
}
var copyright = new ContextMenuItem(linkText, goToThisURL);
myMenu.customItems.push(copyright);
function drawLine(){
//画一条线
_root.lineStyle(3, 0x000000, 100);
_root.moveTo(Math.random()*250, Math.random()*100);
//随机绘制线
_root.lineTo(Math.random()*250, Math.random()*100);
}
var drawLineItem = new ContextMenuItem("绘制一条直线", drawLine);
myMenu.customItems.push(drawLineItem);
//隐藏放大、缩小等项
myMenu.hideBuiltInItems();
//应用新菜单
_root.menu = myMenu;
可以测试看效果 -
PQ Talking Photo-让你的照片说话
2008-1-28
Author: jaland Filed under: 互联网资讯
如你对flash, photo, software等互联网前沿的东西感兴趣,你也许会对”PQ Talking Photo” 这款最新趣味软件感兴趣.
PQ Talking Photo自动声音识别,融合最新的复杂逼真人物动态表情技术,搭配各国语言,让你的照片开口说话.使用Flash 9 / AS3实现复杂的人脸模型算,可在任一台PC上实时计算人脸表情.只需一张照片,便可合成复杂逼真的人物动态表情.制作博客个性头像,留言板,MSN头像,贺卡,人物动画**,会说话的电子相册等.
我个人感觉PQ Talking Photo自动声音识别技术还是挺不错的,比一些做工不够精细的动画片要好很多,声音和图片的完美融合,让图片更加充满趣味,是一款优秀的娱乐软件.
演示demo如下:
