php 超炫 页面,一个超炫的htm5效果.超炫

1. [图片] 炫彩.jpg

29010eda4a29eb00d2c5d376fded3110.png

2. [文件]

star.htm

star

window.onload = function () {

C = Math.cos; // cache Math objects

S = Math.sin;

U = 0;

w = window;

j = document;

d = j.getElementById("c");

c = d.getContext("2d");

W = d.width = w.innerWidth;

H = d.height = w.innerHeight;

c.fillRect(0, 0, W, H); // resize and draw black rect (default)

c.globalCompositeOperation = "lighter"; // switch to additive color application

c.lineWidth = 0.2;

c.lineCap = "round";

var bool = 0,

t = 0; // theta

d.onmousemove = function (e) {

if(window.T) {

if(D==9) { D=Math.random()*15; f(1); }

clearTimeout(T);

}

X = e.pageX; // grab mouse pixel coords

Y = e.pageY;

a=0; // previous coord.x

b=0; // previous coord.y

A = X, // original coord.x

B = Y; // original coord.y

R=(e.pageX/W * 999>>0)/999;

r=(e.pageY/H * 999>>0)/999;

U=e.pageX/H * 360 >>0;

D=9;

g = 360 * Math.PI / 180;

T = setInterval(f = function (e) { // start looping spectrum

c.save();

c.globalCompositeOperation = "source-over"; // switch to additive color application

if(e!=1) {

c.fillStyle = "rgba(0,0,0,0.02)";

c.fillRect(0, 0, W, H); // resize and draw black rect (default)

}

c.restore();

i = 25; while(i --) {

c.beginPath();

if(D > 450 || bool) { // decrease diameter

if(!bool) { // has hit maximum

bool = 1;

}

if(D < 0.1) { // has hit minimum

bool = 0;

}

t -= g; // decrease theta

D -= 0.1; // decrease size

}

if(!bool) {

t += g; // increase theta

D += 0.1; // increase size

}

q = (R / r - 1) * t; // create hypotrochoid from current mouse position, and setup variables (see: http://www.php.cn/)

x = (R - r) * C(t) + D * C(q) + (A + (X - A) * (i / 25)) + (r - R); // center on xy coords

y = (R - r) * S(t) - D * S(q) + (B + (Y - B) * (i / 25));

if (a) { // draw once two points are set

c.moveTo(a, b);

c.lineTo(x, y)

}

c.strokeStyle = "hsla(" + (U % 360) + ",100%,50%,0.75)"; // draw rainbow hypotrochoid

c.stroke();

a = x; // set previous coord.x

b = y; // set previous coord.y

}

U -= 0.5; // increment hue

A = X; // set original coord.x

B = Y; // set original coord.y

}, 16);

}

j.onkeydown = function(e) { a=b=0; R += 0.05 }

d.onmousemove({pageX:300, pageY:290})

}

相关标签:htm5

本文原创发布php中文网,转载请注明出处,感谢您的尊重!

  Smarty是一个使用PHP写出来的模板PHP模板引擎,是目前业界最著名的PHP模板引擎之一。它分离了逻辑代码和外在的内容,提供了一种易于管理和使用的方法,用来将原本与HTML代码混杂在一起PHP代码逻辑分离。简单的讲,目的就是要使PHP程序员同前端人员分离,使程序员改变程序的逻辑内容不会影响到前端人员的页面设计,前端人员重新修改页面不会影响到程序的程序逻辑,这在多人合作的项目中显的尤为重要。   Smarty 3.1.9 更新日志:   - 修正提取()和显示()与相对路径(104期)   - 修正错误的治疗“0000-00-00”0作为在modifier.date_format的(第103)   Smarty优点:   1.速度:采用Smarty编写的程序可以获得最大速度的提高,这一点是相对于其它的模板引擎技术而言的。   2.编译型:采用Smarty编写的程序在运行时要编译成一个非模板技术的PHP文件,这个文件采用了PHPHTML混合的方式,在下一次访问模板时将WEB请求直接转换到这个文件中,而不再进行模板重新编译(在源程序没有改动的情况下)   3.缓存技术:Smarty选用的一种缓存技术,它可以将用户最终看到的HTML文件缓存成一个静态的HTML页,当设定Smarty的cache属性为true时,在Smarty设定的cachetime期内将用户的WEB请求直接转换到这个静态的HTML文件中来,这相当于调用一个静态的HTML文件。   4.插件技术:Smarty可以自定义插件。插件实际就是一些自定义的函数。   5.模板中可以使用if/elseif/else/endif。在模板文件使用判断语句可以非常方便的对模板进行格式重排。   不适合使用Smarty的地方:   1. 需要实时更新的内容。例如像股票显示,它需要经常对数据进行更新,导致经常重新编译模板,所以这类型的程序使用Smarty会使模板处理速度变慢。   2. 小项目。小项目因为项目简单而美工与程序员兼于一人的项目,使用Smarty会在一定程度上丧失PHP开发迅速的优点。 我的网站一直在用,大家有兴趣的可以去看下,www.gg265.net和www.fmrpg.com。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值