IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

Série d'animation en boucle


Sujet :

JavaScript

  1. #1
    Membre averti
    Femme Profil pro
    Étudiant
    Inscrit en
    Juillet 2014
    Messages
    12
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2014
    Messages : 12
    Par défaut Série d'animation en boucle
    Bonjour tout le monde !

    Je chercher à faire une série d'animations en utilisant animate.css (http://daneden.github.io/animate.css/) sans événement particulier, ce sont juste des animations pour dynamiser la page. Donc le concept c'est de faire des FadeInRight/FadeOutRight d'images différentes qui se remplacent en boucle.
    Donc je sais que je dois utiliser setInterval pour la boucle, mais en changeant la classe de l'image pour qu'elle sorte du cadre (et donc ensuite la remplacer par une autre en fadeInRight) je bloque déjà, ça ne fonctionne pas, quelqu'un pour m'éclairer ? Une fonction pour rafraichir et "activer" la nouvelle animation ou quoi ? Ou bien des fonctions Js permettant des FadeIn/fadeout de droite ou de gauche Sachant que je suis une newbie en Javascript..

    Merci d'avance

  2. #2
    Rédacteur/Modérateur

    Avatar de SylvainPV
    Profil pro
    Inscrit en
    Novembre 2012
    Messages
    3 375
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2012
    Messages : 3 375
    Par défaut
    Si c'est pas trop demander, on peut avoir droit à quelque-chose de plus précis que "ça ne fonctionne pas", éventuellement un bout de code ?

  3. #3
    Membre averti
    Femme Profil pro
    Étudiant
    Inscrit en
    Juillet 2014
    Messages
    12
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2014
    Messages : 12
    Par défaut
    Oui, désolée bien sur voilà :
    http://jsfiddle.net/LittleNem/q1vcgLav/5/
    J'avoue que j'attendais d'avoir un code plus consistant que ($element).className=xxxxx; à montrer

  4. #4
    Rédacteur/Modérateur

    Avatar de SylvainPV
    Profil pro
    Inscrit en
    Novembre 2012
    Messages
    3 375
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2012
    Messages : 3 375
    Par défaut
    Voilà c'est débuggué : http://jsfiddle.net/q1vcgLav/11/

    Tu mélangeais des éléments jquery avec des éléments non-jQuery (getElementById). Le passage de callback au animationEnd n'était pas bon, tu dois passer une fonction et non pas un appel de fonction (sinon ça s'exécute immédiatement). Enfin il fallait retirer les classes précédentes avant d'en ajouter de nouvelles.

  5. #5
    Membre averti
    Femme Profil pro
    Étudiant
    Inscrit en
    Juillet 2014
    Messages
    12
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2014
    Messages : 12
    Par défaut
    Paah !
    ça parait tellement évident dis comme ça... Et tellement clairement expliqué, Merci beaucoup !!!!

  6. #6
    Membre averti
    Femme Profil pro
    Étudiant
    Inscrit en
    Juillet 2014
    Messages
    12
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2014
    Messages : 12
    Par défaut
    J'ai rassemblé le one() removeClass() et addClass() dans une fonction, j'aimerais faire une pause entre le fadeInRightBig et fadeOutRightBig donc j'ai trouvé delay() mais il ne fonctionne que lorsque qu'il y a une "queue" d'action si j'ai bien compris et la seule que je vois c'est lorsque l'on fait removeClass() et addClass() (qui sont dans la fonction majClass() ) donc pour moi le delay() se mettrait soit entre removeClass () et addClass() soit avant removeClass() mais aucun des 2 ne va..
    J'ai aussi trouvé setTimeout mais no succes non plus ><

    C'est juste la structure avec la fonction en plus :
    http://jsfiddle.net/LittleNem/q1vcgLav/16/

    J'ai encore besoin d'explications je crois siouplé...

  7. #7
    Rédacteur/Modérateur

    Avatar de SylvainPV
    Profil pro
    Inscrit en
    Novembre 2012
    Messages
    3 375
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2012
    Messages : 3 375
    Par défaut
    Les queues d'animation sont gérées par l'API d'animation de jQuery. Or tu ne l'utilises pas ! Comme son nom l'indique, animate.css gère les animations via CSS, pas jQuery.

    Donc le setTimeout est effectivement la solution, mais dans ton exemple tu le mets au mauvais moment, 2 secondes après le démarrage de l'animation. Or l'animation dure 1.5 seconde donc aucune chance que le callback animationEnd soit appelé dans le callback du timeout, vu qu'il est déjà passé 0.5 secondes avant.

    En mettant les choses dans le bon ordre, ça marche : http://jsfiddle.net/q1vcgLav/17/

  8. #8
    Modérateur

    Avatar de NoSmoking
    Homme Profil pro
    Inscrit en
    Janvier 2011
    Messages
    17 202
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Isère (Rhône Alpes)

    Informations forums :
    Inscription : Janvier 2011
    Messages : 17 202
    Par défaut
    Bonjour,
    pourquoi ne pas gérer l'animation entièrement en CSS3, ou en JS d'ailleurs, en calculant le temps total de l'aller retour compris temps de pause et de faire le ratio pour les étapes des keyframes.

    exemple:
    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    <!DOCTYPE html>
    <html lang="fr">
    <head>
    <meta charset="UTF-8">
    <title>CSS3 animations</title>
    <style>
    body{
        font:1em/1.5em Verdana;
        width:100%;
        overflow:hidden;
    }
    #bloc{
        background-color:red;
        width:300px;
        height:200px;
        margin-left: 100%;
        opacity: 0;
    }
    .effet {
     -webkit-animation-duration: 5s;
        -moz-animation-duration: 5s;
             animation-duration: 5s;
         -webkit-animation-name: moveRightToLeft;
            -moz-animation-name: moveRightToLeft;
                 animation-name: moveRightToLeft;
    }
    @keyframes moveRightToLeft {
        0% {
            margin-left:100%;
        }
        30% {
            opacity:1;
            margin-left:0%;
        }
        70% {
            opacity:1;
            margin-left:0%;
        }
        100% {
            margin-left:100%;
        }
    }
    @-moz-keyframes moveRightToLeft {
        0% {
            margin-left:100%;
        }
        30% {
            opacity:1;
            margin-left:0%;
        }
        70% {
            opacity:1;
            margin-left:0%;
        }
        100% {
            margin-left:100%;
        }
    }
    @-webkit-keyframes moveRightToLeft {
        0% {
            margin-left:100%;
        }
        30% {
            opacity:1;
            margin-left:0%;
        }
        70% {
            opacity:1;
            margin-left:0%;
        }
        100% {
            margin-left: 100%;
        }
    }
    </style>
    </head>
    <body>
    <h1>CSS3 Animation</h1>
    <div id="bloc" class="effet"></div>
    </body>
    </html>

  9. #9
    Membre averti
    Femme Profil pro
    Étudiant
    Inscrit en
    Juillet 2014
    Messages
    12
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2014
    Messages : 12
    Par défaut
    Merci SylvainPV de prendre le temps de m'expliquer aussi précisément
    Je pensais bêtement que les queues étaient l'appellation d'une série d'animations.. Bon au moins j'apprends.

    NoSmoking je connais pas du tout ce principe, je sais qu'il y en a dans mon code css mais j'ai bêtement copier coller du css existant animate.css et utilisé, je vais me documenter dessus ça m'a l'air bien pratique

  10. #10
    Membre averti
    Femme Profil pro
    Étudiant
    Inscrit en
    Juillet 2014
    Messages
    12
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2014
    Messages : 12
    Par défaut
    Finalement je vais finir ce petit projet comme j'ai commencé comme il me reste peu de temps, mais ça m'empêchera pas d'étudier cette façon de faire plus tard.

    Je pensais au moins pouvoir gérer la boucle seule mais je pense que j'ai vraiment du mal avec les timing de setInterval et setTimeout, j'ai pu faire la série d'animations niquel grâce à tes explications SylvainPV

    le soucis actuellement c'est que j'ai une image et un texte pour décrire un produit, l'image fait un fadeInLeft/fadeOutLeft et le text un fadeInRight/fadeOutRight pour qu'ensuite un autre produit remplace et le texte et l'image par des autres et ça en boucle, donc moi ce que j'ai ; le premier produit apparait, disparait, le second apparait disparait, puis le premier tourne en boucle et plus de nouvelles du 2nd...

    là j'essaie de retranscrire sur jsFiddle ce que j'ai fais mais ça commence à devenir complexe pour mon niveau en attendant je vais mettre le code Brut et mon jsfiddle pas très au point pour le moment : http://jsfiddle.net/LittleNem/05ku5eop/1/



    Code Javascript : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    jQuery(function($){
    	function majClass(element,classOrigin,classRemoved,classAdd){
    		element.addClass(classOrigin).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
    			setTimeout(function(){
    				element.removeClass(classRemoved).addClass(classAdd);
    			},3000);    
    		});       
    	}
    	function animation(){
    		$('#Ipad').show();
    		$('#descriptionProd').show();
    		var $elmt = $('#Ipad');
    		var $text = $('#descriptionProd');
    		majClass($elmt,'fadeInLeftBig','fadeInLeftBig','fadeOutLeftBig');
    		majClass($text,'fadeInRightBig','fadeInRightBig','fadeOutRightBig');
    		setTimeout(function(){
    			$text.removeClass('fadeOutRightBig');
    			$elmt.removeClass('fadeOutLeftBig');
    			$text.hide();
    			$elmt.hide();
    			$text = $('#descriptionProd2');
    			$elmt = $('#ipadBlack');
    			$text.show();
    			$elmt.show();
    			majClass($text,'fadeInRightBig','fadeInRightBig','fadeOutRightBig');
    			majClass($elmt,'fadeInLeftBig','fadeInLeftBig','fadeOutLeftBig');
    		},6000);
    	}
    	//Animation
    	$('#descriptionProd2').hide();
    	$('#ipadBlack').hide();
    	$('#Ipad').hide();
    	$('#descriptionProd').hide();
    	//animation en boucle 
    	setInterval(animation,10000);
    	}


    Code html : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    <img src="images/Ipad.png" alt="article" class="article animated" id="Ipad"/>
    <div id="descriptionProd" class="descriptionProd animated">
    	Ipad Blanc <br>Lalala
    	<a href="#"  class="btn aboutProd">Learn
    	more</a>
    </div>
    <img src="images/ipadBlack.png" alt="article" class="article animated" id="ipadBlack"/>
    <div id="descriptionProd2" class="descriptionProd animated">
    	Ipad noir
    	<a href="#" class="btn aboutProd">Learn
    	more</a>
    </div>


    Code css : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    .descriptionProd{
    	position:absolute;
    	top:50px;
    	right:50px;
    	color:white;
    	font-size: 24px;
    }
    .article{
    	position:absolute;
    	top:100px;
    	left:0px;
    }
    //Css du animate.css
    .animated {
      -webkit-animation-duration: 1.5s;
              animation-duration: 1.5s;
      -webkit-animation-fill-mode: both;
              animation-fill-mode: both;
    }
    .animated.infinite {
      -webkit-animation-iteration-count: infinite;
              animation-iteration-count: infinite;
    }
    .animated.hinge {
      -webkit-animation-duration: 2s;
              animation-duration: 2s;
    }
    /* originally authored by Nick Pettit - <a href="https://github.com/nickpettit/glide" target="_blank">https://github.com/nickpettit/glide</a> */
    @-webkit-keyframes fadeInLeftBig {
      0% {
        opacity: 0;
        -webkit-transform: translate3d(-2000px, 0, 0);
                transform: translate3d(-2000px, 0, 0);
      }
      100% {
        opacity: 1;
        -webkit-transform: none;
                transform: none;
      }
    }
    @keyframes fadeInLeftBig {
      0% {
        opacity: 0;
        -webkit-transform: translate3d(-2000px, 0, 0);
                transform: translate3d(-2000px, 0, 0);
      }
      100% {
        opacity: 1;
        -webkit-transform: none;
                transform: none;
      }
    }
    .fadeInLeftBig {
      -webkit-animation-name: fadeInLeftBig;
              animation-name: fadeInLeftBig;
    }
    @-webkit-keyframes fadeInRight {
      0% {
        opacity: 0;
        -webkit-transform: translate3d(100%, 0, 0);
                transform: translate3d(100%, 0, 0);
      }
      100% {
        opacity: 1;
        -webkit-transform: none;
                transform: none;
      }
    }
    @keyframes fadeInRight {
      0% {
        opacity: 0;
        -webkit-transform: translate3d(100%, 0, 0);
                transform: translate3d(100%, 0, 0);
      }
     
      100% {
        opacity: 1;
        -webkit-transform: none;
                transform: none;
      }
    }
     
    .fadeInRight {
      -webkit-animation-name: fadeInRight;
              animation-name: fadeInRight;
    }
     
    @-webkit-keyframes fadeInRightBig {
      0% {
        opacity: 0;
        -webkit-transform: translate3d(2000px, 0, 0);
                transform: translate3d(2000px, 0, 0);
      }
     
      100% {
        opacity: 1;
        -webkit-transform: none;
                transform: none;
      }
    }
     
    @keyframes fadeInRightBig {
      0% {
        opacity: 0;
        -webkit-transform: translate3d(2000px, 0, 0);
                transform: translate3d(2000px, 0, 0);
      }
     
      100% {
        opacity: 1;
        -webkit-transform: none;
                transform: none;
      }
    }
     
    .fadeInRightBig {
      -webkit-animation-name: fadeInRightBig;
              animation-name: fadeInRightBig;
    }
     
    @-webkit-keyframes fadeInUp {
      0% {
        opacity: 0;
        -webkit-transform: translate3d(0, 100%, 0);
                transform: translate3d(0, 100%, 0);
      }
     
      100% {
        opacity: 1;
        -webkit-transform: none;
                transform: none;
      }
    }
     
    @keyframes fadeInUp {
      0% {
        opacity: 0;
        -webkit-transform: translate3d(0, 100%, 0);
                transform: translate3d(0, 100%, 0);
      }
     
      100% {
        opacity: 1;
        -webkit-transform: none;
                transform: none;
      }
    }
     
    .fadeInUp {
      -webkit-animation-name: fadeInUp;
              animation-name: fadeInUp;
    }
     
    @-webkit-keyframes fadeInUpBig {
      0% {
        opacity: 0;
        -webkit-transform: translate3d(0, 2000px, 0);
                transform: translate3d(0, 2000px, 0);
      }
     
      100% {
        opacity: 1;
        -webkit-transform: none;
                transform: none;
      }
    }
     
    @keyframes fadeInUpBig {
      0% {
        opacity: 0;
        -webkit-transform: translate3d(0, 2000px, 0);
                transform: translate3d(0, 2000px, 0);
      }
     
      100% {
        opacity: 1;
        -webkit-transform: none;
                transform: none;
      }
    }
     
    .fadeInUpBig {
      -webkit-animation-name: fadeInUpBig;
              animation-name: fadeInUpBig;
    }
     
    @-webkit-keyframes fadeOut {
      0% {opacity: 1;}
      100% {opacity: 0;}
    }
     
    @keyframes fadeOut {
      0% {opacity: 1;}
      100% {opacity: 0;}
    }
     
    .fadeOut {
      -webkit-animation-name: fadeOut;
              animation-name: fadeOut;
    }
     
    @-webkit-keyframes fadeOutDown {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(0, 100%, 0);
                transform: translate3d(0, 100%, 0);
      }
    }
     
    @keyframes fadeOutDown {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(0, 100%, 0);
                transform: translate3d(0, 100%, 0);
      }
    }
     
    .fadeOutDown {
      -webkit-animation-name: fadeOutDown;
              animation-name: fadeOutDown;
    }
     
    @-webkit-keyframes fadeOutDownBig {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(0, 2000px, 0);
                transform: translate3d(0, 2000px, 0);
      }
    }
     
    @keyframes fadeOutDownBig {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(0, 2000px, 0);
                transform: translate3d(0, 2000px, 0);
      }
    }
     
    .fadeOutDownBig {
      -webkit-animation-name: fadeOutDownBig;
              animation-name: fadeOutDownBig;
    }
     
    @-webkit-keyframes fadeOutLeft {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(-100%, 0, 0);
                transform: translate3d(-100%, 0, 0);
      }
    }
     
    @keyframes fadeOutLeft {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(-100%, 0, 0);
                transform: translate3d(-100%, 0, 0);
      }
    }
     
    .fadeOutLeft {
      -webkit-animation-name: fadeOutLeft;
              animation-name: fadeOutLeft;
    }
     
    @-webkit-keyframes fadeOutLeftBig {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(-2000px, 0, 0);
                transform: translate3d(-2000px, 0, 0);
      }
    }
     
    @keyframes fadeOutLeftBig {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(-2000px, 0, 0);
                transform: translate3d(-2000px, 0, 0);
      }
    }
     
    .fadeOutLeftBig {
      -webkit-animation-name: fadeOutLeftBig;
              animation-name: fadeOutLeftBig;
    }
     
    @-webkit-keyframes fadeOutRight {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(100%, 0, 0);
                transform: translate3d(100%, 0, 0);
      }
    }
     
    @keyframes fadeOutRight {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(100%, 0, 0);
                transform: translate3d(100%, 0, 0);
      }
    }
     
    .fadeOutRight {
      -webkit-animation-name: fadeOutRight;
              animation-name: fadeOutRight;
    }
     
    @-webkit-keyframes fadeOutRightBig {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(2000px, 0, 0);
                transform: translate3d(2000px, 0, 0);
      }
    }
     
    @keyframes fadeOutRightBig {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(2000px, 0, 0);
                transform: translate3d(2000px, 0, 0);
      }
    }
     
    .fadeOutRightBig {
      -webkit-animation-name: fadeOutRightBig;
              animation-name: fadeOutRightBig;
    }
     
    @-webkit-keyframes fadeOutUp {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(0, -100%, 0);
                transform: translate3d(0, -100%, 0);
      }
    }
     
    @keyframes fadeOutUp {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(0, -100%, 0);
                transform: translate3d(0, -100%, 0);
      }
    }
     
    .fadeOutUp {
      -webkit-animation-name: fadeOutUp;
              animation-name: fadeOutUp;
    }
     
    @-webkit-keyframes fadeOutUpBig {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(0, -2000px, 0);
                transform: translate3d(0, -2000px, 0);
      }
    }
     
    @keyframes fadeOutUpBig {
      0% {
        opacity: 1;
      }
     
      100% {
        opacity: 0;
        -webkit-transform: translate3d(0, -2000px, 0);
                transform: translate3d(0, -2000px, 0);
      }
    }
     
    .fadeOutUpBig {
      -webkit-animation-name: fadeOutUpBig;
              animation-name: fadeOutUpBig;
    }
     
    @-webkit-keyframes flip {
      0% {
        -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg);
                transform: perspective(400px) rotate3d(0, 1, 0, -360deg);
        -webkit-animation-timing-function: ease-out;
                animation-timing-function: ease-out;
      }
     
      40% {
        -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);
                transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);
        -webkit-animation-timing-function: ease-out;
                animation-timing-function: ease-out;
      }
     
      50% {
        -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);
                transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);
        -webkit-animation-timing-function: ease-in;
                animation-timing-function: ease-in;
      }
     
      80% {
        -webkit-transform: perspective(400px) scale3d(.95, .95, .95);
                transform: perspective(400px) scale3d(.95, .95, .95);
        -webkit-animation-timing-function: ease-in;
                animation-timing-function: ease-in;
      }
     
      100% {
        -webkit-transform: perspective(400px);
                transform: perspective(400px);
        -webkit-animation-timing-function: ease-in;
                animation-timing-function: ease-in;
      }
    }
     
    @keyframes flip {
      0% {
        -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -360deg);
                transform: perspective(400px) rotate3d(0, 1, 0, -360deg);
        -webkit-animation-timing-function: ease-out;
                animation-timing-function: ease-out;
      }
     
      40% {
        -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);
                transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);
        -webkit-animation-timing-function: ease-out;
                animation-timing-function: ease-out;
      }
     
      50% {
        -webkit-transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);
                transform: perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);
        -webkit-animation-timing-function: ease-in;
                animation-timing-function: ease-in;
      }
     
      80% {
        -webkit-transform: perspective(400px) scale3d(.95, .95, .95);
                transform: perspective(400px) scale3d(.95, .95, .95);
        -webkit-animation-timing-function: ease-in;
                animation-timing-function: ease-in;
      }
     
      100% {
        -webkit-transform: perspective(400px);
                transform: perspective(400px);
        -webkit-animation-timing-function: ease-in;
                animation-timing-function: ease-in;
      }
    }
     
    .animated.flip {
      -webkit-backface-visibility: visible;
              backface-visibility: visible;
      -webkit-animation-name: flip;
              animation-name: flip;
    }
     
    @-webkit-keyframes flipInX {
      0% {
        -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
                transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
        -webkit-transition-timing-function: ease-in;
                transition-timing-function: ease-in;
        opacity: 0;
      }
     
      40% {
        -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
                transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
        -webkit-transition-timing-function: ease-in;
                transition-timing-function: ease-in;
      }
     
      60% {
        -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
                transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
        opacity: 1;
      }
     
      80% {
        -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
                transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
      }
     
      100% {
        -webkit-transform: perspective(400px);
                transform: perspective(400px);
      }
    }
     
    @keyframes flipInX {
      0% {
        -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
                transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
        -webkit-transition-timing-function: ease-in;
                transition-timing-function: ease-in;
        opacity: 0;
      }
     
      40% {
        -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
                transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
        -webkit-transition-timing-function: ease-in;
                transition-timing-function: ease-in;
      }
     
      60% {
        -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
                transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
        opacity: 1;
      }
     
      80% {
        -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
                transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
      }
     
      100% {
        -webkit-transform: perspective(400px);
                transform: perspective(400px);
      }
    }
     
    .flipInX {
      -webkit-backface-visibility: visible !important;
              backface-visibility: visible !important;
      -webkit-animation-name: flipInX;
              animation-name: flipInX;
    }
     
    @-webkit-keyframes flipInY {
      0% {
        -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
                transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
        -webkit-transition-timing-function: ease-in;
                transition-timing-function: ease-in;
        opacity: 0;
      }
     
      40% {
        -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
                transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
        -webkit-transition-timing-function: ease-in;
                transition-timing-function: ease-in;
      }
     
      60% {
        -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
                transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
        opacity: 1;
      }
     
      80% {
        -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
                transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
      }
     
      100% {
        -webkit-transform: perspective(400px);
                transform: perspective(400px);
      }
    }
     
    @keyframes flipInY {
      0% {
        -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
                transform: perspective(400px) rotate3d(0, 1, 0, 90deg);
        -webkit-transition-timing-function: ease-in;
                transition-timing-function: ease-in;
        opacity: 0;
      }
     
      40% {
        -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
                transform: perspective(400px) rotate3d(0, 1, 0, -20deg);
        -webkit-transition-timing-function: ease-in;
                transition-timing-function: ease-in;
      }
     
      60% {
        -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
                transform: perspective(400px) rotate3d(0, 1, 0, 10deg);
        opacity: 1;
      }
     
      80% {
        -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
                transform: perspective(400px) rotate3d(0, 1, 0, -5deg);
      }
     
      100% {
        -webkit-transform: perspective(400px);
                transform: perspective(400px);
      }
    }
     
    .flipInY {
      -webkit-backface-visibility: visible !important;
              backface-visibility: visible !important;
      -webkit-animation-name: flipInY;
              animation-name: flipInY;
    }
     
    @-webkit-keyframes flipOutX {
      0% {
        -webkit-transform: perspective(400px);
                transform: perspective(400px);
      }
     
      30% {
        -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
                transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
        opacity: 1;
      }
     
      100% {
        -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
                transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
        opacity: 0;
      }
    }
     
    @keyframes flipOutX {
      0% {
        -webkit-transform: perspective(400px);
                transform: perspective(400px);
      }
     
      30% {
        -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
                transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
        opacity: 1;
      }
     
      100% {
        -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
                transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
        opacity: 0;
      }
    }
     
    .flipOutX {
      -webkit-animation-name: flipOutX;
              animation-name: flipOutX;
      -webkit-animation-duration: .75s;
              animation-duration: .75s;
      -webkit-backface-visibility: visible !important;
              backface-visibility: visible !important;
    }

    Je bloque dessus depuis ce matin , (ça fait à peine 5 jours que j'ai commencé à utiliser JS pour mon stage, langage que je n'avais jamais utilisé) du coup je fais un tout dernier appel au secours avant de clore ce topic...

  11. #11
    Rédacteur/Modérateur

    Avatar de SylvainPV
    Profil pro
    Inscrit en
    Novembre 2012
    Messages
    3 375
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2012
    Messages : 3 375
    Par défaut
    Ma proposition : http://jsfiddle.net/05ku5eop/2/

    Le mieux est de ne pas s'embrouiller à considérer les éléments un par un avec des ID et tout le reste, mais plutôt de considérer le problème dans son ensemble.
    Attention aussi avec le positionnement absolu en CSS qui risque de fausser le positionnement des éléments avec les animations.

  12. #12
    Membre averti
    Femme Profil pro
    Étudiant
    Inscrit en
    Juillet 2014
    Messages
    12
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 32
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Juillet 2014
    Messages : 12
    Par défaut
    C'est vachement plus optimisé O.o
    Mais je comprends pas encore tout le code comme 'eq' ou articles.length je pense deviner que tout les éléments de classe "article" sont dans un tableau avec comme origine 0, et donc eq sert à récupérer l'élément de l'indice en paramètre...(et enfait c'est pas du tout ça ) je vérifierais, mais ça j'ai la doc au pire donc ça ira,
    J'ai pas encore la logique ou la méthode qu'il faut, mais avec tout ce que tu dis, ça me donne une piste à suivre, en tout cas merci beaucoup

  13. #13
    Rédacteur/Modérateur

    Avatar de SylvainPV
    Profil pro
    Inscrit en
    Novembre 2012
    Messages
    3 375
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2012
    Messages : 3 375
    Par défaut
    Citation Envoyé par BeUnderway Voir le message
    je pense deviner que tout les éléments de classe "article" sont dans un tableau avec comme origine 0, et donc eq sert à récupérer l'élément de l'indice en paramètre...(et enfait c'est pas du tout ça )
    C'est exactement ça en fait La fonction jQuery renvoie toujours un tableau d’éléments enrichi de méthodes propres à jQuery, c'est pour ça que l'on distingue éléments jQuery et éléments pas jQuery. La méthode eq récupère l'élément à un index donné tout en gardant cet enrichissement de méthodes jQuery, tandis que articles.get(index) ou articles[index] renvoie l'élement HTML de base (de constructeur HTMLElement). Il faut utiliser eq pour pouvoir utiliser les méthodes jQuery qui suivent :addClass, next etc...

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Animation en boucle
    Par blitzfan dans le forum DirectX
    Réponses: 0
    Dernier message: 22/02/2009, 17h52
  2. Animation en boucle statique + dynamique
    Par prgasp77 dans le forum Flash
    Réponses: 4
    Dernier message: 07/11/2007, 12h30
  3. animation en boucle
    Par nickg dans le forum Flash
    Réponses: 26
    Dernier message: 11/12/2006, 22h53
  4. Animation en boucle
    Par sinicha dans le forum Flash
    Réponses: 2
    Dernier message: 12/11/2006, 13h17
  5. [FLASH MX2004] Animation qui boucle
    Par pok dans le forum Flash
    Réponses: 2
    Dernier message: 24/10/2005, 01h21

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo