Skip to content

Commit

Permalink
slide the animation
Browse files Browse the repository at this point in the history
  • Loading branch information
LunchBox committed Jun 9, 2009
1 parent 4c563bf commit b6324a7
Showing 1 changed file with 18 additions and 8 deletions.
26 changes: 18 additions & 8 deletions javascripts/image_operator.js
Expand Up @@ -314,22 +314,31 @@ var animation = null;
var animationIndex = 0;
var animationControlBar = null;
function prePage(){
animationIndex = ( animationIndex - 1) % images.length;
if(animationIndex < 0) animationIndex = images.length - 1;
var images = viewer.options.images;
if(animationIndex == 0){
animationIndex = images.length - 1;
}else{
animationIndex = ( animationIndex - 1 ) % images.length;
}

// $("iv_info").innerHTML = animationIndex;
changePage();
var per = animationIndex / (images.length - 1);
animationControlBar.setValue(per);
}
function nextPage(){
var images = viewer.options.images;
animationIndex = ( animationIndex + 1) % images.length;
// $("iv_info").innerHTML = animationIndex;
changePage();
var per = animationIndex/(images.length - 1);

animationControlBar.setValue(per);
}
function changePage(){
function switchPage(percentage){
var images = viewer.options.images;
animationIndex = parseInt(percentage * (images.length - 1));

viewer.image.operator.attr({
src: images[animationIndex]
})
animationControlBar.setValue(animationIndex/images.length);
}
function playAnimation(){
stopAnimation();
Expand Down Expand Up @@ -572,9 +581,10 @@ var ImageViewer = Class.create({
animationControlBar = new Control.Slider("animation_handle", "animation_slider", {
sliderValue: 0,
onSlide: function(v) {

switchPage(v);
},
onChange: function(v) {
switchPage(v);
}
});
},
Expand Down

0 comments on commit b6324a7

Please sign in to comment.