Data / MIT
View on GitHub HypeArrayCursor
Use an array as the basis for a navigable data cursor.
Hype Array Cursor
This script helps you step through a list of items (an array) inside your Tumult Hype project. Think of it as a bookmark that you can move forward and backward through your data.
Functionality
It provides simple commands to navigate a list of data:
next(): Move to the next item.prev(): Move to the previous item.seek(index): Jump to a specific item.at(offset): Get the item at the current position (or an offset from it). You can also usecursorfor the current item,cursorfor the next, etc.
It automatically works with Hype's reactive content, so when you move the cursor, your Hype elements update on their own.
Use Case
This is useful for anything where you need to show one thing from a list at a time.
- Image Carousel/Slideshow: Put your image names in an array and use the cursor to navigate between them.
- Quiz: Store your questions in an array and use
next()to move from one question to the next. - Data Display: Easily cycle through a list of products, testimonials, or any other data set.
