Notifications
Card Slider
Showcase
77
0
This was a test to find different ways to produce a card slider. Our original route was to try the UI explicitly, but Z order is controlled by the hierarchy order. To make our original route work, required adjusting positions in the hierarchy based on where we felt they should be in the rotation. It wasn't too tough to solve, but the code was longer and longer code 'smells' so ultimately, we turned to quads in the 3D environment. This allowed us to have a 3D motion and swivel the cards in about 3 lines of practical code. 1 class to rotate a parent (2 lines) and class to each card at a parent when they moved (2lines). Of course it also had a script to respond to touch, but both had that. There was also an initializer script. The initilizer divided 360 by the number of cards. Then looped through adding one card as a child and rotating the parent. When it was done, we get a perfectly divided circle of cards. This also proved to be low lines, only 14.

Dan Violet Sagmiller
Senior Mobile Developer with GSN Games - Programmer
22
Comments