Hello,
I have different part number like At01, At02, At03 and so on. for each part one or two images is assigned.
So when I select part number then particular image is display this is work(In perspective) but here each part has only one image. Image format I use is jpg
but Now I need to do following task
If part number is selected and part has two different images so, how can we make slide show for images one after one for every 5 sec in one image component
All work in perspective
Make a flex repeater that instantiates views containing your images.
That view should have a ‘img_source’ parameter.
On the flex repeater, create a custom prop that holds the sources to your images, like that:
[
['image 1a', 'image 1b'],
['image 2'],
['image 3'],
['image 4a', 'image 4b']
]
and a custom prop that holds the index of the currently viewed set of images.
then, on the instances
prop of your flex repeater, add an expression binding that looks like this:
{this.custom.data}[{this.custom.current_view}]
and add a script transform:
return [{'img_source': img} for img in value]
You can skip the transform altogether if you directly make custom.data
an array of dicts containing the key, like so:
[
[{'img_source': 'image1'}],
[{'img_source': 'image2a'}, {'img_source': 'image2b'}],
[{'img_source': 'image3'}],
[{'img_source': 'image4a'}, {'img_source': 'image4b'}]
]
Now you only have to change custom.current_view
to go from one set of images to another. Maybe with buttons that increment or decrement it, or with a timer, anything you want.
Just make sure to check for bounds, so you don’t try to display something that doesn’t exist.
Could also use a Carousel for some extra UI to be automatically added.
1 Like
Didn’t know that existed, but I’m not surprised. Should have checked that first !