Unity sliding list sliding monitoring

Preface

There is a function recently, and the requirement is: there is a list of characters in the middle, which can be slid left and right. When the character list slides, the background behind it moves relatively at a certain speed. And there are two directional arrows on the left and right sides of the sliding list. When there is a hidden part on the left (or right), the corresponding arrow needs to be displayed.

Character sliding list

ui creation

Create a hero_scroll circular list, adjust the anchor point to (0.5, 0.5), and align it in the center
1.png

Modify the Content parameters as follows:
2.png

Create a PaintItem. The child nodes include the character's name (name) and the vertical painting (paint).
3.png

Character list sliding effecte.gif

Code

local hero_Render = {}
local heroItem = {}

ui.hero_scroll = base:findco

Guess you like

Origin blog.csdn.net/shirln/article/details/130349825