gestures
Someone

Hi,

Is possible to implement kinetic scrolling, swipe and other gestures directly in wade?

 

How to do a kinetic scrolling with gradual deceleration in a really simple way that not makes games slow? 

 

Those are examples about kinetic scrolling:

 

 

Thanks!

All 6 Comments
foxcode

Hi. WADE does have onSwipe events
onSwipeLeft
onSwipeRight
onSwipeUp
onSwipeDown
 

As for scrolling, I do not think there is a fast way of doing it. I think scrolling would require redrawing everything for every frame that the camera is moving, that is alot of pixels for a mobile device but not too troublesome for a desktop PC

Someone

Hi,

Thank you. Do you know where is a complete list of events supported by Wade?

 

Thanks

Gio

This question gets asked quite often. We should really get round to documenting all the events.

 

First of all, regarding your kinetic scrolling question: we did something similar with zirma, just open the build menu to see it. It's just a behavior that makes use of mouseMove events (and mouseWheel so it works on desktop pc's with a mouse wheel). I don't know if that's what you're looking for, but we'd be happy to share that code when we have a chance to go over it and clean it up a bit.

 

So, events - just a list for the time being, but better that nothing :)

 

onAddToScene

onAnimationEnd

onAnimationStart

onAppTimer

onBlur

onCameraMoveComplete

onClick

onContainerResize

onDeviceMotion

onDeviceOrientation

onFocus

onGamepadButtonDown

onGamepadButtonUp

onGamepadConnected

onGamepadDisconnected

onMouseDown

onMouseIn

onMouseOut

onMouseUp

onMouseWheel

onMoveComplete

onRemoveFromScene

onResize

onSwipeDown

onSwipeLeft

onSwipeRight

onSwipeUp

onUpdate

 

They all work in a similar way,  so you can have objects listening for these events. If any of them returns true from their event handling function, the event propagation stops. If it doesn't stop, eventually the event reaches the App object, so you can have functions like App.onMouseDown to handle "global" events. Additionally, you can use wade.addGlobalEventListener() if you want an object to receive events even when they happen outside the object's boundaries - e.g. if you want object A's onClick event to fire even when object B is clicked.

 

Event handling functions are always passed a single object containing all the relevant event data.

 

If an object has one or more behaviors, all the behaviors receive the events (as well as the object itself).

 

I am also aware that there are some problems with the gamepad events, and that's somethin that we're going to look into for the next release

Someone

Thanks,

I have seen on samples that some of those events have some data like: eventData.screenPosition.x so I think that onGamepadButtonDown must have an eventData with the code of the button that is pressed,etc.

 

Can I have also those data? Can I get them from a html5 event reference?

 

Thank you

Gio

They are not html5-standard events, just specific to WADE.

 

Until we manage to write a full doc about them, the best thing you can do is print out the object that is passed into that function. So for example:

App = function(){    this.onMouseWheel = function(data)    {        console.log(data);    };};

You could do this in the snippets code editor without having to create a new app for it.

 

Usually the names are self-explanatory, but feel free to ask any questions if there are some obscure ones.

 

Proper documentation is coming at some point though.

Someone

Thanks! This forum has really a fantastic support

Post a reply
Add Attachment
Submit Reply
Login to Reply