Hi and yes another airpods question (sorry)!
The animation is running fine on desktop and also iphone. but on my ipad the animation is not smooth at all.
the main difference is that I pinned the canvas.
const canvas = document.getElementById(hero);
const context = canvas.getContext("2d");
canvas.width = 1920;
canvas.height = 1080;
let startTop = 75;
let frameCount = 33;
const currentFrame = index => (
`images/content/anim/hero/gate_${(index + 1).toString().padStart(3, '0')}.jpg`
);
const images = []
const thegate = {
frame: 0
};
for (let i = 0; i < frameCount; i++) {
const img = new Image();
img.src = currentFrame(i);
images.push(img);
}
gsap.to(thegate, {
frame: frameCount - 1,
snap: "frame",
ease: "none",
duration:"3",
scrollTrigger: {
scrub: true,
pin:$("."+herocontainer),
pinSpacing:true,
start:"top "+startTop+"px",
},
onUpdate: render // use animation onUpdate instead of scrollTrigger's onUpdate
});
images[0].onload = render;
function render() {
context.clearRect(0, 0, canvas.width, canvas.height);
context.drawImage(images[thegate.frame], 0, 0);
}
hope you have any idea how to improve the ipad performance.
thx!
ToM