home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

How to make an image transition using CSS?

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2283
Discussions: 200,919, Posts: 2,379,038, Members: 246,287
Old March 7th, 2007, 07:37 AM   Digg it!   #1 (permalink)
Member
 
Join Date: Jun 2004
Posts: 178
How to make an image transition using CSS?

Hi

I want to make an image in a DIV morph into another (in the same DIV) and then back again every ten or 20 seconds, but I want the transition to be smooth. . I was wondering if there is a simple CSS way of doing this, rather than making an animated gif with stacks of frames?

Cheers

Shaun
__________________
I'm looking for a male vocalist to work with. Go to http://people.aapt.net.au/celebritymusic/s...ikingsmith.html to email me
celebritymusic is offline   Reply With Quote
Old March 7th, 2007, 12:06 PM     #2 (permalink)
Super F@D Folder
 
Join Date: Jun 2004
Posts: 5,083
Send a message via AIM to sr71000
nope. you'll be needing an animated gif there. sorry
sr71000 is offline   Reply With Quote
Old March 8th, 2007, 03:39 PM     #3 (permalink)
Banned
 
Iturea's Avatar
 
Join Date: Jan 2004
Location: Earth
Posts: 420
Wink

Quote:
Originally Posted by celebritymusic View Post
Hi

I want to make an image in a DIV morph into another (in the same DIV) and then back again every ten or 20 seconds, but I want the transition to be smooth. . I was wondering if there is a simple CSS way of doing this, rather than making an animated gif with stacks of frames?

Cheers

Shaun

revealTrans filter allows you to transition between images. This should get you started. Adding a timer, etc will give you the effect of the 20
second pause you are looking for. If I had more time I would have
thrown in the timer logic as well.

This may only work in IE. Don't know, don't care... LOL! Copy, paste, make better... GOOD LUCK!
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>  
    <title>
      revealTrans
    </title>
      <script type="text/javascript" xml:space="preserve">
       //<![CDATA[
        var transitionName = 
        ["Box In", "Box Out", 
         "Circle In", "Circle Out",
         "Wipe Up", "Wipe Down"];
 
         var counter = 0;
         var whichImage = true;
 
         function blend()
         {
           if (whichImage) {
               image1.filters( "revealTrans" ).apply();
               image1.style.visibility = "hidden";
               image1.filters( "revealTrans" ).play();
             }
             else {
               image2.filters( "revealTrans" ).apply();
               image2.style.visibility = "hidden";
               image2.filters( "revealTrans" ).play();
             }
         }
 
         function reBlend( fromImage )
         {
           counter++;
 
             if (fromImage) {
               image1.style.zIndex -= 2;
               image1.style.visibility = "visible";
               image2.filters( "revealTrans" ).transition = counter % 6;
             }
             else {
               image1.style.zIndex += 2;
               image2.style.visibility = "visible";
               image1.filters( "revealTrans" ).transition = counter % 6;
             }
 
             whichImage = !whichImage;
             blend();
             transitionDisplay.innerHTML = "Transition " + 
             counter % 6 + ": " + transitionName[ counter % 6 ];
         }
       //]]>
      </script>
  </head>
  <body onload="blend();">
    <img id="image2" src="http://images.techimo.com/timo_images/images/logo.gif" 
         style="position: absolute; left: 10px; top: 10px; width: 246px; 
         z-index:1; visiblity: visible; filter: revealTrans(duration=2, transition=0)" 
         onfilterchange="reBlend( false )" alt="" name="image2" /> 
    <img id="image1" src="http://images.resellerratings.com/images/rrlogo1124b.gif" 
         style="position: absolute; left: 10px; top: 10px; width: 246px; 
         z-index:1; visiblity: visible; filter: revealTrans(duration=2, transition=0)" 
         onfilterchange="reBlend( true )" alt="" name="image1" />
    <div id="transitionDisplay" style="position: absolute; top: 70px; left: 80px;">
      Transition 0: Box In
    </div>
  </body>
</html>

Last edited by Iturea : March 8th, 2007 at 03:42 PM.
Iturea is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make a DIV rest at the bottom of another DIV in CSS? celebritymusic Webmastering and Programming 1 March 1st, 2007 10:15 AM
Unable to figure out how to make a ISO image for a bootable CD videobruce Applications and Operating Systems 1 August 1st, 2006 10:54 AM
Help..make image file from directory/files atlboi Applications and Operating Systems 1 October 21st, 2005 03:20 PM
css linking background image? ClubMed Webmastering and Programming 4 January 7th, 2005 10:05 AM
can't make an image of a CD? help please... zskillz Technical Support 6 May 23rd, 2004 03:42 AM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2844)
Why is Khalid Sheikh Mohammed even .. (9)
Obama the Muslim (9)
Is the PSU I received dead? (10)
windows vista security holes (7)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (9)
Foreign voltage (8)
A good PSU? (10)
Dept. of HS: NSA 'Helped' Develop V.. (15)
Print spooler problem (10)
New Computer wont recognize XP disc (7)
Ideal cheap graph card for PC-Gamin.. (15)
EVGA 9800 gtx help with finding a g.. (8)
Recent Discussions
FiOS modem/router interfering with ne.. (7)
Browsers wont load websites (2)
Virus Doctor Popup? (1)
Help getting around port 80 for camer.. (1)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (31)
Foreign voltage (8)
Dept. of HS: NSA 'Helped' Develop Vis.. (15)
windows vista security holes (7)
Install XP pro and a Vista laptop ?? (9)
EVGA 9800 gtx help with finding a goo.. (8)
Modern Warfare For the PC (32)
Problem with speed step/turbo boost? (1)
monitor will not turn on at all, (0)
Modern Warfare 2: Who Bought It? (61)
World's largest Monopoly Game using G.. (330)
Print spooler problem (10)
SIS 740 and Widescreen (8)
Baffling Problem with my CPU/MoBo's. .. (0)
Display shows 3x5 inch in middle of s.. (0)
HIS HD5770 graphic card question (15)
Best file format to play on Windows H.. (0)
PSP Go bought in Japan (0)
Asus P4G8X Mobo (3)
Need hard disk drivers (4)
windows 7 internet problem (4)


All times are GMT -4. The time now is 06:04 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28