Using Slider for 360 Effect
I'm trying to use the Slider to use in conjunction with 36 images to make a 360º view of it. I'm fairly new to Titanium and don't really know how to make this work. Any help would be greatly appreciated! Thanks!
2 Answers
-
You could name your images like this:
0.png, 1.png, 2.png, etc…Display an imageView with
image:0.png
Then create the slider and on the change event do this:
slider.addEventListener( 'change', function(e) { the_image.image = parseInt(e.value)+'.png' })
//code untested :)
-
Ok figured it out. It works beautifully!
var imageView = Titanium.UI.createView({ backgroundImage:'', width:310, height:233, top:10 }); currentWin.add(imageView); var basicSlider = Titanium.UI.createSlider({ min:0, max:35, value:1, width:100, height:'auto', top:300 }); basicSlider.addEventListener('change', function(e) { Ti.API.info("basicSlide value is: " + basicSlider.value); imageView.backgroundImage = 'images/sfh-18/' + Math.round(basicSlider.value + 1) + '.png'; });
Hope this helps someone!