3D Gallery Using Repeater (velo code only, not custom code)

I’m having trouble with
Repeater layering custom order (Wix has no z-index)

Working in
Wix Editor, Dev Mode

What I’m trying to do
Simple 3D gallery in Velo using repeater (without custom code)

coverflow

What I’ve tried so far
I used the code below and can get a 3D gallery-ish effect. Problem is the layering of the containers. The layering is per repeater _Id order 1-5. How can I customize the layer to perfect the effect?

The container being selected is OK. It is the ones further away that has a layering issue.

For example: When selecting Container 1, Container 2 should be higher than Container 3

function coverFlow() {
    
    $w('#coverFlow').data = [
        {
            "_id": "1",
            "text": "text1" 
        },
        {
            "_id": "2",
            "text": "text2" 
        },
        {
            "_id": "3",
            "text": "text3" 
        },
        {
            "_id": "4",
            "text": "text4" 
        },
        {
            "_id": "5",
            "text": "text5" 
        }
    ]

    const defaultIndex = 2;
    let repeaterItems = [];

    $w('#coverFlow').onItemReady(($item, itemData, index) => {
        $item("#flowText").text = itemData.text;
        const container = $item("#flowContainer");

        repeaterItems[index] = container;

        // Initial scaling setup
        applyCoverflowScaling(defaultIndex);

        container.onMouseIn(() => {
            applyCoverflowScaling(index);
        });

        container.onMouseOut(() => {
            applyCoverflowScaling(defaultIndex);
        });
    });

    function applyCoverflowScaling(paramIndex) {

        const scaleCenter = 1.4;
        const scaleAdjacent = 1.3;
        const scaleOuter = 1.0;
        const playTime = 10; // milliseconds  

        repeaterItems.forEach((item, i) => {
            let scale = scaleOuter; 

            if (i === paramIndex) {
                scale = scaleCenter;
            } else if (Math.abs(i - paramIndex) === 1) {
                scale = scaleAdjacent;
            }

            timeline().add(item, { scale, duration: playTime, easing: "easeOutBack" }).play();
        });

    }

}

I havnt tried this, but maybe you can set the z-order for each item and use sendToBack and bringToFront to sort them.

Since the sendToBack and bringToFront is dynamic, manually order setting partially solves the issue. Unless there is sendToBack and bringToFront in velo code? …How come I can’t find such function in the velo documentation…

hmmm…my mistake. must not be available in the Wix api.
You may need to build this as a custom element or in an iframe.

Yep, you are right. Can’t be done with Velo, so I coded it in html element.

I based the codes from Emet Das on a codepen example. Watch the Youtube video here.

Here is the html code for coverflow suitable for Wix html element which i converted.

Here is my final product:

coverflow Final

2 Likes

No → LAYER-CONTROL ←
But what about Z-INDEX and CSS ??? (at least in Wix-Studio)???

Yeah a lot of control elements (APIs) still missing !!! And it is already 2025!

However → WELL DONE !!!

This is why i am always suggesting either using a HTM-COMPONENT or a CUSTOM-ELEMENT to get thing done the right way and fully CUSTOM and in relaxed creation freedom. To unleash your fully ideas and creations → you need either..

Looks great by the way!!!
coverflow Final

Also already connected to your Wix-Page and Database?
And why not turn into into a full circled CAROUSSEL ???

Work on it and improve it even more!
Then go to Wix-Blocks and create your own new reusable ELEMENT!

Maybe also interesting for you…

1 Like