Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Starting to implement animate imagery feature with up button

IamTechknow4a2cbc304c1f
diff --git a/web/js/date/wv.date.anim.js b/web/js/date/wv.date.anim.js
index e764b25ef..2e0098242 100644
--- a/web/js/date/wv.date.anim.js
+++ b/web/js/date/wv.date.anim.js
@@ -12,6 +12,7 @@
* http://opensource.gsfc.nasa.gov/nosa.php
*/
var wv = wv || {};
+ var days = 0; //keep track of how many days to animate
wv.date = wv.date || {};
wv.date.anim = wv.date.anim || function(model, ui, options) {
@@ -68,15 +69,17 @@
self.delta : -self.delta;
var newDate = wv.util.dateAdd(model.selected, self.interval, amount);
ui.preload(newDate);
- timer = setTimeout(function() {
+ timer = setTimeout(function() { //this function is called once after 500 ms
advance(newDate);
}, self.delay);
+ days++;
};
var advance = function(newDate) {
notify("advance");
var updated = model.select(newDate);
- if ( !updated ) {
+ if ( !updated || days >= 4 ) { //do this 5 times
+ days = 0;
self.stop();
} else {
prepareFrame();
diff --git a/web/js/date/wv.date.timeline.input.js b/web/js/date/wv.date.timeline.input.js
index da5e1ae98..6eb08ab42 100644
--- a/web/js/date/wv.date.timeline.input.js
+++ b/web/js/date/wv.date.timeline.input.js
@@ -29,6 +29,8 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
var self = {};
var timer, rollingDate;
+
+ var daysCount = 0;
var $incrementBtn = $("#right-arrow-group");
var $decrementBtn = $("#left-arrow-group");
@@ -277,6 +279,14 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
animateForward("day");
event.preventDefault();
break;
+ case wv.util.key.UP:
+ //Start an animation that repeats every sec but resets after 5 times. We need global variable to keep track
+ //var myVar = setInterval(function(){
+ animateReverse("day");
+ event.preventDefault();
+ //}, 1000);
+
+ break;
}
})
@@ -287,6 +297,7 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
switch ( event.keyCode ) {
case wv.util.key.LEFT:
case wv.util.key.RIGHT:
+ console.log("Animation stopped");
animateEnd();
event.preventDefault();
break;
@@ -378,5 +389,6 @@ wv.date.timeline.input = wv.date.timeline.input || function(models, config, ui)
};
init();
+
return self;
};