PDA

View Full Version : Help with altering this Transition Blending code


dsm1995gst
03-30-2003, 10:06 PM
I want to change this code so that it works with more than 2 images (looking to use 4 or 5 images). Can anyone help?

function blend()
{
if ( whichImage ) {
image1.filters( "blendTrans" ).apply();
image1.style.visibility = "hidden";
image1.filters( "blendTrans" ).play();
}
else {
image2.filters( "blendTrans" ).apply();
image2.style.visibility = "hidden";
image2.filters( "blendTrans" ).play();
}
}

function reBlend ( fromImage )
{
if ( fromImage ) {
image1.style.zIndex -= 2;
image1.style.visibility = "visible";
}
else {
image1.style.zIndex += 2;
image2.style.visibility = "visible";
}

whichImage = !whichImage;
blend();
}

</script>
</head>

<body style = "color: darkblue;"
onload = "blend()">



<img id = "image2" src = "images/plato.jpg"
onfilterchange = "reBlend( false )"
style = "position: absolute; left: 152; top: 137;
height: 121; width: 180; filter: blendTrans( duration = 3 );
z-index: 1" alt = "Second Transition Image" />

<img id = "image1" src = "images/aristotle.jpg"
onfilterchange = "reBlend( true )"
style = "position: absolute; left: 152; top: 137;
height: 121; width: 180; filter: blendTrans( duration = 3 );
z-index: 2" alt = "First Transition Image" />" /> -->

Borgtex
03-31-2003, 12:10 AM
this could be something to start with:

function blend(imgname)
{
with (document.images[imgname])
{
filters( "blendTrans" ).apply();
style.visibility = "hidden";
filters( "blendTrans" ).play();
}
}


blend('img1')
blend('img2')
...