本文目录一览:
- 1、求修改一段C++黑客帝国屏保的代码
- 2、黑客帝国--绿色字母雨代码--知道的进
- 3、怎么把黑客帝国的这段代码放在html主页的背后
- 4、求"黑客帝国"里电脑屏幕上的"代码"不间断滚动的代码,
- 5、我要黑客帝国里的数字流星雨代码,用html或asp写的
- 6、html5黑客帝国下面代码大概什么意思呀。谢啦
求修改一段C++黑客帝国屏保的代码
在WndProc这个回调函数里加个鼠标移动消息(WM_MOUSEMOVE)的判断即可。
由于这个消息很灵敏,你感觉鼠标没有动,实际也退出了。所以,在这个消息下面再加上一个移动距离的判断即可。距离越短,鼠标移动时退出检测就越灵敏。
例如:
case WM_MOUSEMOVE:
{
static int xPos = 0;// 上一次鼠标位置
static int yPos = 0;
// 如果是0则是第一次接收,存储第一次鼠标位置
if (xPos == 0 || yPos == 0)
{
xPos = LOWORD(lParam);
yPos = HIWORD(lParam);
return 0;
}// 如果不是第一次接收,说明已有上次鼠标位置数据,与本次位置判断一下移动距离(即灵敏度)即可
else if ( abs(xPos - LOWORD(lParam)) 100 || abs(yPos -HIWORD(lParam)) 100 )
{
PostQuitMessage(0);// 鼠标移动大于100就退出
}
return 0;
}
abs求出绝对值来判断,可以保证如果算出负数距离仍能正确退出。lParam包含鼠标的xy坐标,需要LOWORD和HIWORD来取出。
实际上很简单,对吧?
黑客帝国--绿色字母雨代码--知道的进
BODY
script language="JavaScript"
!--
if (document.all){
Cols=6;
Cl=24;//Space's are included so real length is 48!
Cs=10;
Ts=10;
Tc='#008800';
Tc1='#00ff00';
MnS=20;
MxS=30;
I=Cs;
Sp=new Array();S=new Array();Y=new Array();
C=new Array();M=new Array();B=new Array();
RC=new Array();E=new Array();Tcc=new Array(0,1);
document.write("div id='Container' style='position:absolute;top:0;left:-"+Cs+"'");
document.write("div style='position:relative'");
for(i=0; i Cols; i++){
S[i]=I+=Cs;
document.write("div id='A' style='position:absolute;top:0;font-family:Arial;font-size:"
+Ts+"px;left:"+S[i]+";width:"+Ts+"px;height:0px;color:"+Tc+";visibility:hidden'/div");
}
document.write("/div/div");
for(j=0; j Cols; j++){
RC[j]=1+Math.round(Math.random()*Cl);
Y[j]=0;
Sp[j]=Math.round(MnS+Math.random()*MxS);
for(i=0; i RC[j]; i++){
B[i]='';
C[i]=Math.round(Math.random()*1)+' ';
M[j]=B[0]+=C[i];
}
}
function Cycle(){
Container.style.top=window.document.body.scrollTop;
for (i=0; i Cols; i++){
var r = Math.floor(Math.random()*Tcc.length);
E[i] = 'font color='+Tc1+''+Tcc[r]+'/font';
Y[i]+=Sp[i];
if (Y[i] window.document.body.clientHeight){
for(i2=0; i2 Cols; i2++){
RC[i2]=1+Math.round(Math.random()*Cl);
for(i3=0; i3 RC[i2]; i3++){
B[i3]='';
C[i3]=Math.round(Math.random()*1)+' ';
C[Math.floor(Math.random()*i2)]=' '+' ';
M[i]=B[0]+=C[i3];
Y[i]=-Ts*M[i].length/1.5;
A[i].style.visibility='visible';
}
Sp[i]=Math.round(MnS+Math.random()*MxS);
}
}
A[i].style.top=Y[i];
A[i].innerHTML=M[i]+' '+E[i]+' ';
}
setTimeout('Cycle()',20)
}
Cycle();
}
// --
/script
演示地址:
注:必须要有body标签~
怎么把黑客帝国的这段代码放在html主页的背后
!--使用position:absolute;z-index:100;--
canvas id="q"/canvas
div id="main" style=" position:absolute;z-index:100;top:10px;width:960px;height:400px;background:red;"123/div
script type="text/javascript"
var s = window.screen;
var width = q.width = s.width;
var height = q.height = s.height;
var letters = Array(256).join(1).split('');
var _div=document.getElementById("main");
_div.style.left=(width-960)/2+"px";//给主页面left定位;
var draw = function () {
q.getContext('2d').fillStyle='rgba(0,0,0,.05)';
q.getContext('2d').fillRect(0,0,width,height);
q.getContext('2d').fillStyle='#0F0';
letters.map(function(y_pos, index){
text = String.fromCharCode(3e4+Math.random()*33);
x_pos = index * 10;
q.getContext('2d').fillText(text, x_pos, y_pos);
letters[index] = (y_pos 758 + Math.random() * 1e4) ? 0 : y_pos + 10;
});
};
setInterval(draw, 33);
/script
求"黑客帝国"里电脑屏幕上的"代码"不间断滚动的代码,
把下面复制到记事本,另存为HTML文件。你可以自己DIY一下。
html
head
title类似黑客帝国的01数字流/title
/head
body bgcolor=#000000
script language="JavaScript"
!--
if (document.all){
Cols=6;
Cl=24;//Space's are included so real length is 48!
Cs=10;
Ts=10;
Tc='#008800';
Tc1='#00ff00';
MnS=20;
MxS=30;
I=Cs;
Sp=new Array();S=new Array();Y=new Array();
C=new Array();M=new Array();B=new Array();
RC=new Array();E=new Array();Tcc=new Array(0,1);
document.write("div id='Container' style='position:absolute;top:0;left:-"+Cs+"'");
document.write("div style='position:relative'");
for(i=0; i Cols; i++){
S[i]=I+=Cs;
document.write("div id='A' style='position:absolute;top:0;font-family:Arial;font-size:"
+Ts+"px;left:"+S[i]+";width:"+Ts+"px;height:0px;color:"+Tc+";visibility:hidden'/div");
}
document.write("/div/div");
for(j=0; j Cols; j++){
RC[j]=1+Math.round(Math.random()*Cl);
Y[j]=0;
Sp[j]=Math.round(MnS+Math.random()*MxS);
for(i=0; i RC[j]; i++){
B[i]='';
C[i]=Math.round(Math.random()*1)+' ';
M[j]=B[0]+=C[i];
}
}
function Cycle(){
Container.style.top=window.document.body.scrollTop;
for (i=0; i Cols; i++){
var r = Math.floor(Math.random()*Tcc.length);
E[i] = 'font color='+Tc1+''+Tcc[r]+'/font';
Y[i]+=Sp[i];
if (Y[i] window.document.body.clientHeight){
for(i2=0; i2 Cols; i2++){
RC[i2]=1+Math.round(Math.random()*Cl);
for(i3=0; i3 RC[i2]; i3++){
B[i3]='';
C[i3]=Math.round(Math.random()*1)+' ';
C[Math.floor(Math.random()*i2)]=' '+' ';
M[i]=B[0]+=C[i3];
Y[i]=-Ts*M[i].length/1.5;
A[i].style.visibility='visible';
}
Sp[i]=Math.round(MnS+Math.random()*MxS);
}
}
A[i].style.top=Y[i];
A[i].innerHTML=M[i]+' '+E[i]+' ';
}
setTimeout('Cycle()',20)
}
Cycle();
}
// --
/script
body
/body
/html
我要黑客帝国里的数字流星雨代码,用html或asp写的
htmlstyle type="text/css"
!--
body {
background-color: #000000;
}
--
/style
Body
script language="JavaScript"
!--
if (document.all){
Cols=60;
Cl=20;//Space's are included so real length is 48!
Cs=20;
Ts=20;
Tc='#008800';
Tc1='#00ff00';
MnS=20;
MxS=30;
I=Cs;
Sp=new Array();S=new Array();Y=new Array();
C=new Array();M=new Array();B=new Array();
RC=new Array();E=new Array();Tcc=new Array(0,1);
document.write(" div id='Container' style='position:absolute;top:0;left:-"+Cs+"'");
document.write(" div style='position:relative'");
for(i=0; i Cols; i++){
S[i]=I+=Cs;
document.write(" div id='A' style='position:absolute;top:0;font-family:Arial;font-size:"
+Ts+"px;left:"+S[i]+";width:"+Ts+"px;height:0px;color:"+Tc+";visibility:hidden' /div");
}
document.write(" /div /div");
for(j=0; j Cols; j++){
RC[j]=1+Math.round(Math.random()*Cl);
Y[j]=0;
Sp[j]=Math.round(MnS+Math.random()*MxS);
for(i=0; i RC[j]; i++){
B[i]='';
C[i]=Math.round(Math.random()*1)+' ';
M[j]=B[0]+=C[i];
}
}
function Cycle(){
Container.style.top=window.document.body.scrollTop;
for (i=0; i Cols; i++){
var r = Math.floor(Math.random()*Tcc.length);
E[i] = ' font color='+Tc1+''+Tcc[r]+' /font';
Y[i]+=Sp[i];
if (Y[i] window.document.body.clientHeight){
for(i2=0; i2 Cols; i2++){
RC[i2]=1+Math.round(Math.random()*Cl);
for(i3=0; i3 RC[i2]; i3++){
B[i3]='';
C[i3]=Math.round(Math.random()*1)+' ';
C[Math.floor(Math.random()*i2)]=' '+' ';
M[i]=B[0]+=C[i3];
Y[i]=-Ts*M[i].length/1.5;
A[i].style.visibility='visible';
}
Sp[i]=Math.round(MnS+Math.random()*MxS);
}
}
A[i].style.top=Y[i];
A[i].innerHTML=M[i]+' '+E[i]+' ';
}
setTimeout('Cycle()',20)
}
Cycle();
}
// --
/script
/body
/html
演示地址:
网上找的代码,我给你改了下
html5黑客帝国下面代码大概什么意思呀。谢啦
HTML:
canvas id="c"/canvas
CSS:
canvas {display: block;}
JS:
var c = document.getElementById("c");
var ctx = c.getContext("2d");
//全屏
c.height = window.innerHeight;
c.width = window.innerWidth;
//文字
var txts = "0123456789";
//转为数组
txts = txts.split("");
var font_size = 16;
var columns = c.width/font_size;
//用于计算输出文字时坐标,所以长度即为列数
var drops = [];
//初始值
for(var x = 0; x columns; x++)
drops[x] = 1;
//输出文字
function draw()
{
//让背景逐渐由透明到不透明
ctx.fillStyle = "rgba(0, 0, 0, 0.05)";
ctx.fillRect(0, 0, c.width, c.height);
ctx.fillStyle = "#0F0"; //文字颜色
ctx.font = font_size + "px arial";
//逐行输出文字
for(var i = 0; i drops.length; i++)
{
//随机取要输出的文字
var text = txts[Math.floor(Math.random()*txts.length)];
//输出文字,注意坐标的计算
ctx.fillText(text, i*font_size, drops[i]*font_size);
//如果绘满一屏或随机数大于0.95(此数可自行调整,效果会不同)
if(drops[i]*font_size c.height || Math.random() 0.95)
drops[i] = 0;
//用于Y轴坐标增加
drops[i]++;
}
}
setInterval(draw, 33);
解释了的很详细了。