- Home /
iOS Scroll Effect - SceneGUI Objects
Hello,
I'm creating a GUI within my scene (using planes, and quads basically - Not OnGUI) and I want to be able to scroll a quad up and down via the users finger slide. I want to mimic the iOS scroll effect really.
I've looked at a couple of plugins that automate this such as 'FingerGesture' though that doesn't actually have any support for real time scroll effects. Although it make my job a little easier by using the DeltaTime:
I guess I can make my own by simply using the Input.GetButtonDown("Fire1"), so I did this:
function OnDrag(gesture : DragGesture){
var phase = gesture.Phase;
var deltaMove = gesture.DeltaMove;
var totalMove = gesture.TotalMove;
//print("Drag: [Phase] " + phase + " [Delta] " + deltaMove + " [Total] " + totalMove);
if(slider.localPosition.y >= 0.37)
slider.localPosition.y += (deltaMove.y / 360) / 2;
else
slider.localPosition.y = 0.37;
}
This allows me to slide my content up and down, although I would like to add the same bounciness you get on the iOS. Also, the content flickers when I pull my content down, past 0.37 (because its being reset). How can I avoid the flicker? And add a bounce?
Thanks
Correction - when I place my finger on the screen, the content slider jumps to ZERO, until I start to slide