Cheer 发表于 2007-4-28 11:02:44

图形特效网页加载时图片_波动

把下列代码加到网页的<body></body>标签之间 从google下载我的照片管理软件
<!--网页加载时图片_波动-->
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">

<title>aspease</title>
<script language="javascript" fptype="dynamicanimation">
<!--
function dynanimation() {}
function clickswapimg() {}
//-->
</script>
<script language="javascript1.2" fptype="dynamicanimation">
<!--
        // see kb article about changing this dynamic html
        dynamicanimattr = "dynamicanimation"
        animcancel = "skipanim"
        fpanimationprefix = "fpanim"
        animateelements = new array()
        currentelement = 0
        speed = 1
        stepszoom = 8
        stepsword = 8
        stepsfly = 17
        stepsspiral = 16
        stepsspiralword = 19
        stepselastic = 32
        steps = stepszoom
        step = 0
        cornerphase=0
        outeffect=0
        function remsuffix(str)
        {
                ind=str.indexof("fp")
                str = str.substring(0,ind)
                return str
        }
        function dynanimout(el)
        {
                outeffect=1
                dynanimation(el)
                outeffect=0
        }
        function dynanimation(obj)
        {
                animateelements = new array()
                var ms = navigator.appversion.indexof("msie")
                ie4 = (ms>0) && (parseint(navigator.appversion.substring(ms+5, ms+6)) >= 4)
                if(!ie4)
                {
                        if((navigator.appname == "netscape") &&
                                (parseint(navigator.appversion.substring(0, 1)) >= 4))
                                doc_els=document.layers
                        else
                                return
                }
                else
                        doc_els=document.all
      if(outeffect && !ie4)
            return
                if(ie4)
                {
                  for (index=document.all.length-1; index >= document.body.sourceindex; index--)
                        {
                                el = document.all
                                if(outeffect && el != obj)
                                        continue
                                if(outeffect)
                                        animationid = el.id.substring(9,el.id.length)
                                else
                                        animationid = el.id.substring(6,el.id.length)
                                animation=remsuffix(animationid)
                                if(null != animation)
                                {
                                        altcnt=0
                                        if(        animation == "dropword"                                ||
                                                animation == "flytoprightword"                        ||
                                                animation == "flybottomrightword"                ||
                                                animation == "wavewords"                        ||
                                                animation == "hopwords")
                                        {
                                                ih = el.innerhtml
                                                outstring = ""
                                                i1 = 0
                                                iend = ih.length
                                                while(true)
                                                {
                                                        i2 = startword(ih, i1)
                                                        if(i2 == -1)
                                                        i2 = iend
                                                        outword(ih, i1, i2, false, "", outeffect ? obj.id : el.id)
                                                        if(i2 == iend)
                                                                break
                                                        i1 = i2
                                                        i2 = endword(ih, i1)
                                                        if(i2 == -1)
                                                                i2 = iend
                                                        if (animation == "wavewords")
                                                                outwordalt(ih, i1, i2, true, animation, altcnt)
                                                        else
                                                                outword(ih, i1, i2, true, (outeffect ? "out" : "") + animation,
                                                                        outeffect ?obj.id : el.id)

                                                        if(i2 == iend)
                                                                break
                                                        i1 = i2
                                                        altcnt++
                                                }
                                                document.all.innerhtml = outstring
                                                document.all.style.posleft = 0
                                                document.all.setattribute(animcancel, true)
                                                document.all.style.visibility="visible"
                                        }
                                }
                        }
                }
                i = 0
                for (index=0; index < doc_els.length; index++)
                {
                        el = doc_els
                        if(0 != el.id.indexof(fpanimationprefix))
                                continue
                        if (ie4)
                        {
                                elprops=el.style
                                scrolloffsettop=document.body.scrolltop
                                docheight=document.body.offsetheight
                                docwidth=document.body.offsetwidth
                                elw=100
                                elh=el.offsetheight
                        }
                        else
                        {
                                elprops=el
                                scrolloffsettop=window.pageyoffset
                                docheight=window.innerheight
                                docwidth=window.innerwidth
                                elw=el.clip.width
                                elh=el.clip.height
                        }
                        if(outeffect)
                                animationid = el.id.substring(9,el.id.length)
                        else
                                animationid = el.id.substring(6,el.id.length)
                        animation=remsuffix(animationid)
                        if(outeffect && (obj != el))
                        {
                                if(el.srcid != obj.id)
                                        continue
                        }
                        if (null != animation )
                        {
                                if(ie4 && null!=el.getattribute(animcancel, false))
                                        continue
                                if(!ie4)
                                {
                                        elprops.posleft=elprops.left
                                        elprops.postop=elprops.top
                                }
                                el.startl=offsetleft(el)
                                if(animation == "flyleft")
                                {
                                        elprops.posleft = -offsetleft(el)-elw
                                        elprops.postop = 0
                                }
                                else if(animation == "flyright" || animation=="elasticright")
                                {
                                        elprops.posleft = -offsetleft(el)+docwidth
                                        elprops.postop = 0
                                }
                                else if(animation == "flytop" || animation == "dropword")
                                {
                                        elprops.posleft = 0
                                        elprops.postop = scrolloffsettop-offsettop(el)-elh
                                }
                                else if(animation == "flybottom" || animation == "elasticbottom")
                                {
                                        elprops.posleft = 0
                                        elprops.postop = scrolloffsettop-offsettop(el)+docheight
                                }
                                else if(animation == "flytopleft")
                                {
                                        elprops.posleft = -offsetleft(el)-elw
                                        elprops.postop = scrolloffsettop-offsettop(el)-elh
                                }
                                else if(animation == "flytopright" || animation == "flytoprightword")
                                {
                                        elprops.posleft = -offsetleft(el)+docwidth
                                        elprops.postop = scrolloffsettop-offsettop(el)-elh
                                }
                                else if(animation == "flycorner")
                                {
                                        elprops.posleft = docwidth*0.2-offsetleft(el)
                                       
                                        elprops.postop = scrolloffsettop-offsettop(el)+docheight
                                }
                                else if(animation == "flybottomleft")
                                {
                                        elprops.posleft = -offsetleft(el)-elw
                                        elprops.postop = scrolloffsettop-offsettop(el)+docheight
                                }
                                else if(animation == "flybottomright" || animation == "flybottomrightword")
                                {
                                        elprops.posleft = -offsetleft(el)+docwidth
                                        elprops.postop = scrolloffsettop-offsettop(el)+docheight
                                }
                                else if(animation == "spiral")
                                {
                                        elprops.posleft = -offsetleft(el)+docwidth
                                        elprops.postop = scrolloffsettop-offsettop(el)+docheight
                                }
                                else if((animation.indexof("wavewords") != -1) || animation=="hopwords")
                                {
                                        if(i)
                                        {
                                                prevel=animateelements
                                                elprops.r = offsetleft(el)-prevel.startl
                                        }
                                        else
                                                elprops.r = offsetleft(el)
                                }
                                else if(animation == "wipelr" || animation == "wipemid")
                                {
                                        if (ie4 && elprops.position=="absolute")
                                        {
                                                el.sizew=el.offsetwidth
                                                elprops.clip="rect(0 0 0 0)"
                                        }
                                        else if (!ie4)
                                        {
                                                el.sizew=el.clip.width
                                                el.clip.width=0
                                        }
                                }
                                else if(animation == "wipetb")
                                {
                                        if (ie4 && elprops.position=="absolute")
                                        {
                                                elprops.clip="rect(0 0 0 0)"
                                        }
                                        else if(!ie4)
                                        {
                                                el.sizeh=el.clip.height
                                                el.clip.height=0
                                        }
                                }
                                else if(animation == "zoomin")
                                {
                                        elprops.posleft = 0
                                        elprops.postop = 0
                                }
                                else if(animation == "zoomout")
                                {
                                        elprops.posleft = 0
                                        elprops.postop = 0
                                }
                                else
                                {
                                        continue
                                }
                                if(!outeffect)
                                {
                                        el.initleft = elprops.posleft
                                        el.inittop= elprops.postop
                                        el.endleft= 0
                                        el.endtop   = 0
                                        elprops.visibility = "hidden"
                                }
                                else
                                {
                                        el.initleft = 0
                                        el.inittop= 0
                                        el.endleft = elprops.posleft
                                        el.endtop= elprops.postop
                                        elprops.postop = 0
                                        elprops.posleft = 0
                                }
                                if(!ie4)
                                {
                                        elprops.left=elprops.initleft
                                        elprops.top =elprops.inittop
                                }
                                animateelements = el
                        }
                }
                if(animateelements.length > 0)
                {
                        if(outeffect)
                                window.settimeout("animate(1);", speed, "javascript")
                        else
                                window.settimeout("animate(0);", speed, "javascript")
                }
        }
        function offsetleft(el)
        {
                if(ie4)
                {
                        x = el.offsetleft
                        for (e = el.offsetparent; e; e = e.offsetparent)
                                x += e.offsetleft
                        return x
                }
                else
                {
                        x = el.pagex
                        return x
                }
        }
        function offsettop(el)
        {
                if(ie4)
                {
                        y = el.offsettop
                        for (e = el.offsetparent; e; e = e.offsetparent)
                                y += e.offsettop;
                        return y
                }
                else
                {
                        y = el.pagey
                        return y       
                }
        }
        function startword(ih, i)
        {
                for(tag = false; i < ih.length; i++)
                {
                        c = ih.charat(i)
                        if(c == '<')
                        {
                                if(ih.substring(i+1, i+4) == "img")
                                return i;
                                tag = true
                        }
                        if(!tag)
                                return i
                        if(c == '>')
                                tag = false
                }
                return -1
        }
        function endword(ih, i)
        {
                nonspace = false
                space = false
                img = false
                if(ih.charat(i) == '<')
                {
                        img = true
                        i++;
                }
                while(i < ih.length)
                {
                        c = ih.charat(i)
                        if(c != ' ')
                                nonspace = true
                        if(img && c == '>')
                                img = false;
                        if(nonspace && !img && c == ' ')
                                space = true
                        if(c == '<')
                                return i
                        if(space && c != ' ')
                                return i
                        i++
                }
                return -1
        }
        function outword(ih, i1, i2, dyn, anim, srcid)
        {
                if(dyn)
                        if(!outeffect)
                                outstring += "<span id=\"" +fpanimationprefix + anim + "fp\" style=\"position: relative; visibility: hidden;\">"
                        else
                                outstring += "<span srcid=\"" + srcid + "\"id=\"" +fpanimationprefix + anim + "fp\" style=\"position: relative;\">"
                outstring += ih.substring(i1, i2)
                if(dyn)
                        outstring += "</span>"
        }
        function outwordalt(ih, i1, i2, dyn, anim, altcnt)
        {
                if(dyn)
                {
                        if(altcnt%2)
                                outstring += "<span id=\"" +fpanimationprefix + anim + "lfp\" style=\"position: relative;visibility: hidden;\">"
                        else
                                outstring += "<span id=\"" +fpanimationprefix + anim + "rfp\" style=\"position: relative;visibility: hidden;\">"
                }
                       
                outstring += ih.substring(i1, i2)
                if(dyn)
                        outstring += "</span>"
        }
        function animate(animout)
        {
                el = animateelements
                if(animout)
                        animationid = el.id.substring(9,el.id.length);
                else
                        animationid = el.id.substring(6,el.id.length);
                animation=remsuffix(animationid)
                if (ie4)
                        elprops=el.style
                else
                        elprops=el

                if(!step && !animout)
                        elprops.visibility="visible"
                step++
                if(animation == "spiral")
                {
                        steps = stepsspiral
                        v = step/steps
                        rf = 1.0 - v
                        t = v * 2.0*math.pi
                        rx = math.max(math.abs(el.initleft), 200)
                        ry = math.max(math.abs(el.inittop),200)
                        elprops.posleft = math.ceil(-rf*math.cos(t)*rx)
                        elprops.postop= math.ceil(-rf*math.sin(t)*ry)
                }
                else if(animation == "wavewordsl" || animation=="hopwords" || animation == "wavewords")
                {
                        steps = stepsspiralword
                        v = step/steps
                        rf = (1.0 - v)
                        t = v * 1.0*math.pi
                        elprops.posleft = math.ceil(-rf*math.cos(t)*elprops.r)
                        elprops.postop= math.ceil(-rf*math.sin(t)*elprops.r)
                }
                else if(animation == "wavewordsr")
                {
                        steps = stepsspiralword
                        v = step/steps
                        rf = (1.0 - v)
                        t = v * 1.0*math.pi
                        elprops.posleft = math.ceil(-rf*math.cos(t)*elprops.r)
                        elprops.postop= math.ceil( rf*math.sin(t)*elprops.r)
                }
                else if(animation == "zoomin")
                {
                        steps = stepszoom
                        elprops.fontsize = math.ceil(50+50*step/steps) + "%"
                        elprops.posleft = 0
                }
                else if(animation == "zoomout")
                {
                        steps = stepszoom
                        fontsz=math.ceil(100+200*(steps-step)/steps) + "%"
                        elprops.fontsize = fontsz
                        elprops.posleft = 0
                }
                else if(animation == "elasticright")
                {
                        steps = stepselastic
                        v = step/steps
                        rf=math.exp(-v*7)
                        t = v * 1.5*math.pi
                        rx =math.abs(el.initleft)
                        elprops.posleft = rf*math.cos(t)*rx
                        elprops.postop= 0
                }
                else if(animation == "elasticbottom")
                {
                        steps = stepselastic
                        v = step/steps
                        rf=math.exp(-v*7)
                        t = v * 2.5*math.pi
                        ry =math.abs(el.inittop)
                        elprops.posleft = 0
                        elprops.postop= rf*math.cos(t)*ry
                }
                else if(animation == "wipelr")
                {
                        steps = stepselastic
                        if(ie4 && elprops.position=="absolute")
                                elprops.clip = "rect(0 "+ step/steps*100 +"% 100% 0)"
                        else if (!ie4)
                        {
                                elprops.clip.right=step/steps*el.sizew
                        }
                }
                else if(animation == "wipetb")
                {
                        steps = stepselastic
                        if(ie4 && elprops.position=="absolute")
                                elprops.clip = "rect(0 100% "+step/steps*el.offsetheight+"px 0)"
                        else
                                elprops.clip.bottom=step/steps*el.sizeh
                }
                else if(animation == "wipemid")
                {
                        steps = stepselastic
                        if(ie4 && elprops.position=="absolute")
                        {
                                elprops.clip = "rect(0 "+el.sizew/2*(1+step/steps)+"px 100% "+el.sizew/2*(1-step/steps)+")"
                        }
                        else if(!ie4)
                        {
                                elprops.clip.right=el.sizew/2*(1+step/steps)
                                elprops.clip.left=el.sizew/2*(1-step/steps)
                        }
                }
                else if(animation == "flycorner")
                {
                        if(!cornerphase)
                        {
                                steps = stepselastic/2
                                v = step/steps
                                rf=math.exp(-v*7)
                                t = v * 2.5*math.pi
                                ry =math.abs(el.inittop)
                                elprops.postop= rf*math.cos(t)*ry
                        }
                        else
                        {
                                steps = stepsfly
                                dl = el.initleft / steps
                                elprops.posleft = elprops.posleft - dl
                                elprops.postop = 0
                        }
                }
                else
                {
                        steps = stepsfly
                        if(animation == "dropword" || animation == "flytoprightword" || animation == "flybottomrightword")
                                steps = stepsword
                        dl = (el.endleft - el.initleft) / steps
                        dt = (el.endtop- el.inittop)/ steps
                        elprops.posleft = elprops.posleft + dl
                        elprops.postop = elprops.postop + dt
                }
                if (step >= steps)
                {
                        if(!(animation == "wipelr"        ||
                                animation== "wipetb"        ||
                                animation== "wipemid"        ||
                                (animation == "flycorner" && !cornerphase)))
                        {
                                elprops.posleft = el.endleft
                                elprops.postop = el.endtop
                        }
                        if(animout)
                        {
                                elprops.visibility="hidden"
                        }

                        step = 0
                        if(animation=="flycorner" && !cornerphase)
页: [1]
查看完整版本: 图形特效网页加载时图片_波动