Android Question Board game-like animation

udg

Expert
Licensed User
Longtime User
Hi all,

I've spent a few hours reading through tutorials and animation libs threads but I'm still not sure about the way to go for a very simple visual effect.

Let's say I have got a "board" made up of n X n "tiles".
I'd like to be able to capture a swiping motion over a tile and start an animation where that tile is smoothly swaped with its adjacent ones in the direction of the swipe (horizontal, vertical, diagonal).
Better of, if the action goes on until the user lift his finger.

Tiles could be anything from buttons to panels to imageviews or any other visible object.

So, which is your suggested way to achieve that visual effect?

TIA,

Umberto
 
Last edited:

udg

Expert
Licensed User
Longtime User
Hi stevel05,

thank you for your hint.
As is, a Draggable View let me move one of my visual objects around but there's no provision to animate the "surrounding" ones accordingly.
I mean, when Tile(0,0), the top-leftmost one moves right I'd like Tile(0,1), the one on its right, to move left synchrounsly with the former. And so on until the user lift its finger (or a border or any other stop condition is reached).
The end result should be an animated swapping of those tiles.

Umberto
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
You would need to use similar movement code on the adjoining tiles, driven by the touch on the original tile. There are animation possibilities, but I believe these are set up and go type animations that wouldn't be able to respond to changes in speed or direction etc (if the user changes their mind).
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Hi stevel05,

I somehow managed to sync two adjoining tiles. More difficult I first imagined but now it works.
A lot more work is expecting me before that "simple" app could be said done..

Anyway, I'd like to thank you for the invaluable suggestion about Draggable Views, something I didn't know before.

Umberto
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Hi stevel05,

I somehow managed to sync two adjoining tiles. More difficult I first imagined but now it works.
A lot more work is expecting me before that "simple" app could be said done..

Anyway, I'd like to thank you for the invaluable suggestion about Draggable Views, something I didn't know before.

Umberto
You should have a look at the Floating Windows class. I use it to move tiles in my game "My Playground".
 
Upvote 0

udg

Expert
Licensed User
Longtime User
Hi Informatix,

looks that most of my app's desidered behaviour is part of your Floating Windows class.. :)
No reason to reinvent the wheel, so I'll study your code. Thank you so much.

Umberto
 
Upvote 0
Top