Bonjour @Rodrigue,
Thank you for all the information you've provided.
The demo doesn't work but the piece of code responsible for displaying the slideshow does display correctly.
I could share a stackblitz link if this post is unreadable and I apologize in advance.
For the moment, we only want to test GSAP, and then we'll see if we need a special license. Thanks again for your help.
Here's the code snippet and video link: (slideshow starts at the sixth second)
import {Img, Sequence, interpolate, useCurrentFrame, useVideoConfig} from 'remotion';
import gsap from 'gsap';
import {useRef} from 'react';
import {useGsapTimeline} from '../../Template01-06photos/utils/useGsapTimeline';
export const Card = ({photos, animation_photo}) => {
const videoConfig = useVideoConfig();
const frame = useCurrentFrame();
const {fps, durationInFrames} = useVideoConfig();
const imageDurationFrames = Math.floor(videoConfig.fps * 3); // 3 seconds per image
const photoCount = photos ? photos.length : 0;
const currentPhotoIndex = Math.floor((frame / durationInFrames) * photoCount);
const translateXZoom = interpolate(frame, [0, imageDurationFrames], [0, -5]);
const translateY = interpolate(frame, [0, imageDurationFrames], [0, -5]);
const scale = interpolate(frame, [0, imageDurationFrames], [1, 1.2]);
// Calculates the image index to be displayed as a function of elapsed time
const imageIndex = currentPhotoIndex % photoCount;
const translateX = interpolate(frame, [0, videoConfig.durationInFrames], [0, -180]);
const opacity = Math.min(1, frame / 60);
const pictureRefs = photos.map(() => useRef(null));
let targets = gsap.utils.toArray(pictureRefs);
const animationBoxRef =
useGsapTimeline <
HTMLDivElement >
(() => {
const timeline = gsap.timeline();
pictureRefs.forEach((ref, index) => {
timeline.to(targets[1].current, {
//
});
});
return timeline;
});
return photos ? (
<>
{photos.map((photo, index) => (
<Sequence ref={animationBoxRef} key={index} from={index * imageDurationFrames} durationInFrames={imageDurationFrames}>
{animation_photo == 'zoom' ? (
<Img
src={photo}
ref={pictureRefs[index]}
className="photo"
style={{
objectFit: 'cover',
width: '100%',
height: '100%',
transform: `translateX(${translateXZoom}px) translateY(${translateY}px) scale(${scale})`,
}}
/>
) : (
<Img src={photo} ref={pictureRefs[index]} style={{objectFit: 'cover', width: '100%', height: '100%', transform: `translateX(${translateX}px) scale(1.2)`}} />
)}
</Sequence>
))}
</>
) : null;
};