Hello!
Two and a half months ago I posted a question in this forum but I still haven’t managed to solve it.
I am creating a 3D slideshow of a sequence of 2D images, although it seems I can not move to the next images.
This is the code (https://codepen.io/scarscarin/pen/zYrOojw). I am using an imgArray and a Math.tan to move the particles and create a hyperloop effect. I want the image to change after the hyperloop but, although the imageIndex value adds up, the img stays the same
var imageIndex = 0;
function createPixelData() {
var image = document.createElement("img");
var imgArray = new Array();
imgArray[0] = new Image();
imgArray[0].src = 'img01.jpg';
imgArray[1] = new Image();
imgArray[1].src = 'img02.jpg';
imgArray[2] = new Image();
imgArray[2].src = 'img03.jpg';
image.src = imgArray[imageIndex].src;
}
function update() {
shaderUniforms.amplitude.value = Math.tan(animationTime);
animationTime += animationDelta;
if (shaderUniforms.amplitude.value > Math.tan(animationTime)) {
imageIndex++;
}
Any tips?
Best,
Leo