Z-index avec TweenMax

Par LesTutossUE4, il y a 12 ans


Bonjour,
J'utilise la librairie TweenMax comme dans le tutoriel.
Je cherche à changer les z-index de certains éléments pendant l'animation.
Je voudrais que les éléments passent au premier plein chacun leur tour.
Je connais cette méthode :

$("#Bienvenue").css("z-index", "5");

Mais cela s'applique au chargement de la page et non pendant l'animation.

Voici mon animation :

var start = new TimelineLite();
start.from("#BackGround", 1.5, {left: "50px"});
start.from("#BackGround span", 1.5, {autoAlpha: 0},"-=1.5");
start.from("#BackGround img", 1.5, {autoAlpha: 0});
start.from("#Bienvenue", 1.5, {left: "50px"});
start.to("#Bienvenue h1", 1.5, {autoAlpha: 1},"-=1.5");
start.to("#Bienvenue", 1, {left: "50px"},"+=2");
start.to("#Bienvenue h1", 1, {autoAlpha: 0}, "-=1.2");
start.from("#Language", 1.5, {left: "50px"});
start.to("#Language h1", 1.5, {autoAlpha: 1},"-=1.5");
start.staggerTo("#Language img.flag", 0.3, {autoAlpha: 1, scale:1}, 0.2);

Y'a-t-il une fonction de ce type ou quelque chose du genre :

start.function(){
    $("#Bienvenue").css("z-index", "1");
    $("#Language").css("z-index", "5");
}

Merci d'avance.

6 réponses

LesTutossUE4, il y a 12 ans

Oui il en a une . Le z-index fonctionne. Mais le {z-index:5} n'existe pas.

antho07, il y a 12 ans

Bonjour

start.to("#Bienvenue",durée,{z-index:5}) marche pas?

LesTutossUE4, il y a 12 ans

Non à mon plus grand regret :'(

NotANumber, il y a 12 ans

Salut,

L'élément ou tu veux ajouter la propriété "z-index" a t-elle une propriété de position (relative, absolute ou fixed) ?
Sinon rajoute en une.

LesTutossUE4, il y a 12 ans

Merci beaucoup :)