基于VB算法+Picture+Timer控件制作的39种动画效果,类似屏保(完整原程序)[3]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 lshdic 的 blog

if pos1 mod 2 <> 0 then   '如果是奇数则向右扩展,否则向左
p.line (wid / 2 + pos1, 0)-(wid / 2 + pos1, hei), color1
else
p.line (wid / 2 - pos1, 0)-(wid / 2 - pos1, hei), color1
end if
case 6   '随机线段
rnd1 = wid * rnd: rnd2 = hei * rnd
rnd3 = rnd * 1000: if rnd3 < 500 then rnd3 = -rnd3
rnd4 = rnd * 1000: if rnd4 < 500 then rnd4 = -rnd4
for i = 0 to 3: p.line (rnd1, rnd2)-(rnd1 + rnd3, rnd2 + rnd4), color1: next
case 7   '随机颗粒
for i = 0 to 3: p.pset (wid * rnd, hei * rnd), color1: next
case 8   '虚拟葫芦
rnd1 = wid * rnd: rnd2 = hei * rnd
for i = 0 to 5
temp1 = 8 + (i * 3)
p.drawwidth = temp1
p.pset (rnd1 + (temp1 * 6 * i), rnd2 + (temp1 * 6 * i)), color1
next
case 9   '三维十字
wid1 = wid / 2: hei1 = hei / 2
if pos1 * 2 < wid then pos1 = pos1 + 7 else pos1 = 1
if pos1 mod 2 = 0 then
p.line (wid1 + pos1, 0)-(wid1 + pos1, hei), color1
p.line (0, hei1 + pos1)-(wid, hei1 + pos1), color1
else
p.line (wid1 - pos1, 0)-(wid1 - pos1, hei), color1
p.line (0, hei1 - pos1)-(wid, hei1 - pos1), color1
end if
case 10  'x型极光
if pos1 * 2 < wid then pos1 = pos1 + 21 else pos1 = 1
if pos1 mod 2 = 0 then
p.line (0 + pos1, 0)-(wid + pos1, hei), color1
p.line (wid + pos1, 0)-(0 + pos1, hei), color1
else
p.line (0 - pos1, 0)-(wid - pos1, hei), color1
p.line (wid - pos1, 0)-(0 - pos1, hei), color1
end if
case 11  '金字魔塔
wid1 = wid / 2: hei1 = hei / 2
if pos1 * 3 < wid then pos1 = pos1 + 15 else pos1 = 1
p.line (wid1, hei1 - pos1)-(wid1 + (pos1 * 2), hei1 + pos1), color1
p.line -(wid1 - (pos1 * 2), hei1 + pos1), color1
p.line -(wid1, hei1 - pos1), color1
case 12  '天地之吻
if pos1 * 2 > hei then lihe = false
if pos1 < 25 then lihe = true
if lihe = false then pos1 = pos1 - 20 else pos1 = pos1 + 20
p.line (0, 0 + pos1)-(wid, 0 + pos1), color1
p.line (wid, hei - pos1)-(0, hei - pos1), color1
case 13  '堕落天使
if pos1 < hei then pos1 = pos1 + 5 else pos1 = 0
rnd1 = wid * rnd
p.line (rnd1, pos1)-(rnd1, pos1 + (500 * rnd)), color1
p.line (0, pos1 - 800)-(wid, pos1 - 800), p.backcolor
case 14  '地狱之火
if pos1 < hei then pos1 = pos1 + 7 else pos1 = 0
wid1 = wid / 2
if pos1 > hei / 2 then    '绘制火山
pos2 = pos1
else
p.line (wid1 - 800, hei)-(wid1, hei - 500), color1
p.line -(wid1 + 800, hei), color1
end if
pos2 = pos2 + 1: p.pset (wid1 + (pos2 * (rnd - 0.5)), hei - 500 - (pos2 * (rnd + 0.4))), color1
p.pset (wid1 + (pos1 * (rnd - 0.5)), hei - 500 - (pos1 * (rnd + 0.4))), color1
case 15  '流金岁月
if pos1 > -hei then pos1 = pos1 - 5 else pos1 = 0
rnd1 = wid * rnd: rnd2 = hei * rnd
p.line (rnd1, hei + pos1)-(rnd1, hei + pos1 - (rnd * 500)), color1
p.line (rnd1, rnd2)-(rnd1, rnd2 + (rnd * 500)), p.backcolor
case 16  '光环之舞
if pos1 < 300 then pos1 = pos1 + 15 else pos1 = 0: if pos2 < 299 then pos2 = 300
wid1 = wid / 2: hei1 = hei / 2
p.line (pos1, pos1)-(wid - pos1, hei - pos1), color1, b
if pos2 < 299 then
p.circle (wid1, hei1), pos1, color1, , , 1
else
pos2 = pos2 + 15
if pos2 > hei then pos2 = 0: pos1 = 0: p.cls
p.circle (wid1, hei1), pos2, color1, , , 1
end if
case 17  '成长衰亡
wid1 = wid / 2: hei1 = hei / 2
if pos1 > hei1 then lihe = false
if pos1 < 10 then lihe = true
if lihe = false then
p.circle (wid1, hei1), pos1, p.backcolor
pos1 = pos1 - 10
else
pos1 = pos1 + 10
p.circle (wid1, hei1), pos1, color1, , , abs(rnd + 0.5)
end if
case 18  '光之冲撞
wid1 = wid / 2: hei1 = hei / 2: rnd1 = rnd * 200
if pos1 < wid then pos1 = pos1 + 20 else p.cls: pos1 = 0: pos2 = 0
if rnd1 < 100 then rnd1 = -(rnd1 - 50) else rnd1 = rnd1 - 50
p.line (pos1, hei1 + rnd1)-(pos1 + 100, hei1 + rnd1), color1
p.line (wid - pos1, hei1 + rnd1)-(wid - pos1 - 100, hei1 + rnd1), -color1
if pos1 > wid / 2 then pos2 = pos2 + 20: p.circle (wid1, hei1), pos2, color1, , , rnd
case 19  '生命繁衍
p.cls: pos1 = pos1 + 1
if pos1 mod 50 = 0 and ubound(xx) < 500 then
temp1 = ubound(xx) + 1
redim preserve xx(temp1): redim preserve yy(temp1)
redim preserve jiax(temp1): redim preserve jiay(temp1)
xx(temp1) = wid * rnd: yy(temp1) = hei * rnd
end if
for i = 0 to ubound(xx)
if hei - yy(i) < 150 then jiay(i) = false
if wid - xx(i) < 150 then jiax(i) = false
if yy(i) < 150 then jiay(i) = true
if xx(i) < 150 then jiax(i) = true
if jiay(i) = true then yy(i) = yy(i) + 50 else yy(i) = yy(i) - 50
if jiax(i) = true then xx(i) = xx(i) + 50 else xx(i) = xx(i) - 50
p.circle (xx(i), yy(i)), 200, color1
next
case 20  '起起落落
if pos1 < 20 then lihe = true
if pos1 > hei - 2500 then lihe = false
if lihe = false then pos1 = pos1 - 30 else pos1 = pos1 + 30
p.cls
wid1 = wid / 2: hei1 = hei / 2

本文关键:picture 算法 动画 屏幕保护 特效
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top