Current location: Hot Scripts Forums » General Web Coding » JavaScript » plzzzz.help me out


plzzzz.help me out

Reply
  #1 (permalink)  
Old 06-15-05, 04:10 PM
ajay007_bond ajay007_bond is offline
Newbie Coder
 
Join Date: Jun 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
plzzzz.help me out

How to animate stored satellite images since 1hr back,2hr back,3 hr back...so on...

and we have to set up the control like fast,slow,very slow....

Is there any script to do this way
Reply With Quote
  #2 (permalink)  
Old 06-16-05, 07:00 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
What kind of animation? If you want a simple replace-this-image-with-this-image-after-a-set-amount-of-time-animation My suggestion would be to do something like this:

Code:
<head>
<script>
var millisecondsBetweenSwaps=3000
var Images = new Array("Image1.jpg","Image2.jpg","Image3.jpg")
var Preloads=new Array()
var imageNum=0

for(var i=0;i<Images.length;i++){
 Preloads[i]=new Image()
 Preloads[i].src=Images[i]
}

function swap(){
 document.getElementById('ImageHolder').src=Preloads[(imageNum=(imageNum+1)%Preloads.length)].src
}
swap()
setInterval("swap()",millisecondsBetweenSwaps)
</script>
</head>
<body>
<img id="ImageHolder">
</body>
Note: Untested code
Reply With Quote
  #3 (permalink)  
Old 06-16-05, 11:38 AM
ajay007_bond ajay007_bond is offline
Newbie Coder
 
Join Date: Jun 2005
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
This script is not working dude

I need to place the controls like fast, slow,very fast to adjust the movement of satellite images.......

and Moreover I need to keep the controls like 1hour back,2 hour back,3 hour back images ...as control buttons
Reply With Quote
  #4 (permalink)  
Old 06-16-05, 01:19 PM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
To set different speeds, place a button like this:
Code:
//Change setInterval("Swap()",millisecondsBetweenSwaps) to var timer = setInterval("Swap()",millisecondsBetweenSwaps)
<input type="button" value="Slow" onclick="clearInterval(timer);millisecondsBetweenSwaps=5000;timer=setInterval('Swap()',millisecondsBetweenSwaps)">
<input type="button" value="Fast" onclick="clearInterval(timer);millisecondsBetweenSwaps=3000;timer=setInterval('Swap()',millisecondsBetweenSwaps)">
<input type="button" value="Very Fast" onclick="clearInterval(timer);millisecondsBetweenSwaps=1000;timer=setInterval('Swap()',millisecondsBetweenSwaps)">
To move between different images, add this:
Code:
<input type="Button" value="Back 1 hour" onclick="clearInterval(timer);imageNum-=2;swap();setInterval('Swap()',millisecondsBetweenSwap)">
<input type="Button" value="Back 2 hours" onclick="clearInterval(timer);imageNum-=3;swap();setInterval('Swap()',millisecondsBetweenSwap)">
<input type="Button" value="Back 3 hours" onclick="clearInterval(timer);imageNum-=4;swap();setInterval('Swap()',millisecondsBetweenSwap)">
Note: Still untested.
Edit: Weird, the forum inserts spaces into my code
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 10:48 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.