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

Mise en page CSS Discussion :

Comment insérer un cube 3D dans un autre cube 3D


Sujet :

CSS

  1. #1
    Membre éprouvé

    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    981
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 981
    Points : 1 028
    Points
    1 028
    Billets dans le blog
    36
    Par défaut Comment insérer un cube 3D dans un autre cube 3D
    Bonjour à tous,


    J'ai un cube 3D (cf post Comment lancer l'effet d'éclatement d'un cube 3D......merci pour l'aide apportée par NoSmoking et dans lequel j'aimerai insérer un cube 3D plus petit. Mais voilà, si j'ajoute le code ci-dessous, j'ai deux cubes l'un contre l'autre.

    Alors comment faire pour avoir un cube type poupée russe (matriochkas)... Da!

    J'ai donc ajouté l'appel à un CSS dont le code est le suivant
    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
     
    body
    {
     
    }
        .cube1
        {
            position: absolute;
            width: 75px;
            height: 75px;
     
            /* Forcer le navigateur à conserver le mode de rendu 3d (ce qui n'est pas le cas par défaut) */
            -webkit-transform-style: preserve-3d;
            -moz-transform-style: preserve-3d;
            -ms-transform-style: preserve-3d;
            -o-transform-style: preserve-3d;
            transform-style: preserve-3d;
     
            /* Application d'une animation sur l'élément .cube (qui contient nos faces) */
            -webkit-animation: rotate-cube 15s linear infinite;
            animation: rotate-cube 15s linear infinite;
        }
     
            /** Toutes les faces du cube ont la classe .cubeface
                (plus pratique que d'écrire #face1, #face2, ...)
                **/
            .cubeface1
            {
                position: absolute;
     
                /** Application d'une transition pour
                    avoir un effet d'interpolation entre
                    l'état normal et l'état :hover pour
                    chaque face
                    **/
                -webkit-transition: all 600ms;
                -moz-transition: all 600ms;
                -ms-transition: all 600ms;
                -o-transition: all 600ms;
                transition: all 600ms;
            }
     
            /** On déplace chaque face dans l'espace indépendamment,
                pour construire notre cube
                **/
            #face7 {
                -webkit-transform: translateZ(37px);
                -moz-transform: translateZ(37px);
                -ms-transform: translateZ(37px);
                -o-transform: translateZ(37px);
                transform: translateZ(37px);
            }
            #face8 {
                -webkit-transform: translateX(37px) rotateY(90deg);
                -moz-transform: translateX(37px) rotateY(90deg);
                -ms-transform: translateX(37px) rotateY(90deg);
                -o-transform: translateX(37px) rotateY(90deg);
                transform: translateX(37px) rotateY(90deg);
            }
            #face9 {
                -webkit-transform: translateX(-37px) rotateY(-90deg);
                -moz-transform: translateX(-37px) rotateY(-90deg);
                -ms-transform: translateX(-37px) rotateY(-90deg);
                -o-transform: translateX(-37px) rotateY(-90deg);
                transform: translateX(-37px) rotateY(-90deg);
            }
            #face10 {
                -webkit-transform: translateZ(-37px);
                -moz-transform: translateZ(-37px);
                -ms-transform: translateZ(-37px);
                -o-transform: translateZ(-37px);
                transform: translateZ(-37px);
            }
            #face11 {
                -webkit-transform: translateY(37px) rotateX(90deg);
                -moz-transform: translateY(37px) rotateX(90deg);
                -ms-transform: translateY(37px) rotateX(90deg);
                -o-transform: translateY(37px) rotateX(90deg);
                transform: translateY(37px) rotateX(90deg);
            }
            #face12 {
                -webkit-transform: translateY(-37px) rotateX(-90deg);
                -moz-transform: translateY(-37px) rotateX(-90deg);
                -ms-transform: translateY(-37px) rotateX(-90deg);
                -o-transform: translateY(-37px) rotateX(-90deg);
                transform: translateY(-37px) rotateX(-90deg);
            }
     
    /** Définition du comportement de l'animation qui fera tourner le cube **/
    @-webkit-keyframes rotate-cube
    {
        from { -webkit-transform: rotateY(0deg) rotateZ(0deg); }
        to { -webkit-transform: rotateY(360deg) rotateZ(360deg); }
    }
     
    @keyframes rotate-cube
    {
        from { transform: rotateY(0deg) rotateZ(0deg); }
        to { transform: rotateY(360deg) rotateZ(360deg); }
    }


    Le code CSS suivant à été supprimé car déjà appelé dans le CSS du premier cube conteneur (Cf Comment lancer l'effet d'éclatement d'un cube 3D...)
    Code : 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
    .centered
    {
        /** On positionne le bloc au centre **/
        position: absolute;
        top: 50%;
        left: 50%;
        width: 100px;
        height: 100px;
        margin-left: -75px;
        margin-top: -75px;
    }
    .stage
    {
        /* Application d'une perspective pour pouvoir avoir un rendu 3D */
        -webkit-perspective: 700px;
        -moz-perspective: 700px;
        -ms-perspective: 700px;
        -o-perspective: 700px;
        perspective: 700px;
    }


    Et j'ai ajouté le code HTML suivant

    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
     
       <div class="stage centered">
            <div class="cube">
                <img class="cubeface" id="face1" src="chemin/abeille150.jpg" />
                <img class="cubeface" id="face2" src="chemin/consultant150.png" />
                <img class="cubeface" id="face3" src="chemin/paul150.png" />
                <img class="cubeface" id="face4" src="chemin/plouf150.gif" />
                <img class="cubeface" id="face5" src="chemin/trinity150.gif" />
                <img class="cubeface" id="face6" src="chemin/platine150.gif" />
            </div>
     
             <div class="cube1">
                <img class="cubeface1" id="face7" src="chemin/paul75.png" />
                <img class="cubeface1" id="face8" src="chemin/consultant75.png" />
                <img class="cubeface1" id="face9" src="chemin/paul75.png" />
                <img class="cubeface1" id="face10" src="chemin/consultant75.png" />
                <img class="cubeface1" id="face11" src="chemin/paul75.png" />
                <img class="cubeface1" id="face12" src="chemin/consultant75.png" />
            </div>
    </div>

    Le chiffre qui suffixe le nom de l'image indique le nombre de pixels

    Merci pour toute aide
    Mal nommer un objet, c'est ajouter au malheur de ce monde, car le mensonge est justement la grande misère humaine, c'est pourquoi la grande tâche humaine correspondante sera de ne pas servir le mensonge
    Poésie 44, n° 17 - Albert Camus

    Mes réponses vous ont aidés, un clic sur leur pouce vert
    Bonjour chez vous

  2. #2
    Membre expérimenté

    Homme Profil pro
    Webmaster
    Inscrit en
    Mai 2011
    Messages
    1 049
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Belgique

    Informations professionnelles :
    Activité : Webmaster
    Secteur : Enseignement

    Informations forums :
    Inscription : Mai 2011
    Messages : 1 049
    Points : 1 689
    Points
    1 689
    Billets dans le blog
    2
    Par défaut
    En mettant une div dans la div cube. Au besoin utiliser z-index pour placer cube1 au-dessus s'il est caché par le plus grand cube.
    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
       <div class="stage centered">
            <div class="cube">
                <img class="cubeface" id="face1" src="chemin/abeille150.jpg" />
                <img class="cubeface" id="face2" src="chemin/consultant150.png" />
                <img class="cubeface" id="face3" src="chemin/paul150.png" />
                <img class="cubeface" id="face4" src="chemin/plouf150.gif" />
                <img class="cubeface" id="face5" src="chemin/trinity150.gif" />
                <img class="cubeface" id="face6" src="chemin/platine150.gif" />
     
     
                     <div class="cube1">
                            <img class="cubeface1" id="face7" src="chemin/paul75.png" />
                            <img class="cubeface1" id="face8" src="chemin/consultant75.png" />
                            <img class="cubeface1" id="face9" src="chemin/paul75.png" />
                            <img class="cubeface1" id="face10" src="chemin/consultant75.png" />
                            <img class="cubeface1" id="face11" src="chemin/paul75.png" />
                            <img class="cubeface1" id="face12" src="chemin/consultant75.png" />
                      </div>
              </div>
      </div>

  3. #3
    Invité
    Invité(e)
    Par défaut
    Bonjour,

    Voir : cube 3D - CSS3 + jQuery

    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
    <div class="stage">
      <div class="cube cube2">
        <img class="face" src="http://www.photodenature.fr/wp-content/uploads/2015/01/photo-Dauphin.jpg" />
        <img class="face" src="http://www.photodenature.fr/wp-content/uploads/2015/01/photo-H%C3%A9ron-goliath-6.jpg" />
        <img class="face" src="http://www.photodenature.fr/wp-content/uploads/2015/01/photo-Tortue-3.jpg" />
        <img class="face" src="http://www.photodenature.fr/wp-content/uploads/2015/01/photo-Putois-%C3%A0-pieds-noirs-2.jpg" />
        <img class="face" src="http://www.photodenature.fr/wp-content/uploads/2014/09/photo-Lama-8.jpg" />
        <img class="face" src="http://www.photodenature.fr/wp-content/uploads/2014/07/photo-Coq-domestique-4.jpg" />
      </div>
     
      <div class="cube cube1">
        <img class="face" src="http://www.photodenature.fr/wp-content/uploads/2015/01/photo-Dauphin.jpg" />
        <img class="face" src="http://www.photodenature.fr/wp-content/uploads/2015/01/photo-H%C3%A9ron-goliath-6.jpg" />
        <img class="face" src="http://www.photodenature.fr/wp-content/uploads/2015/01/photo-Tortue-3.jpg" />
        <img class="face" src="http://www.photodenature.fr/wp-content/uploads/2015/01/photo-Putois-%C3%A0-pieds-noirs-2.jpg" />
        <img class="face" src="http://www.photodenature.fr/wp-content/uploads/2014/09/photo-Lama-8.jpg" />
        <img class="face" src="http://www.photodenature.fr/wp-content/uploads/2014/07/photo-Coq-domestique-4.jpg" />
      </div>
    </div>
    Important : le HTML de cube2 est écrit avant celui de cube1 (sinon, il faut ajouter des z-index pour mettre cube1 au 1er plan)
    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
    .stage {
      position: absolute;
      width:100%;
      height:100%;
      /* Application d'une perspective pour pouvoir avoir un rendu 3D */
      -webkit-perspective: 700px;
      -moz-perspective: 700px;
      -ms-perspective: 700px;
      -o-perspective: 700px;
      perspective: 700px;
      margin:0;
      padding:0;
    }
     
    .cube.cube1 {
     /* z-index:2;*//*1er plan*/
      position: absolute;
      width: 150px;
      height: 150px;
      top: 50%;
      left: 50%;
      margin-left: -75px;
      margin-top: -75px;
      /* Forcer le navigateur à conserver le mode de rendu 3d (ce qui n'est pas le cas par défaut) */
      -webkit-transform-style: preserve-3d;
      -moz-transform-style: preserve-3d;
      -ms-transform-style: preserve-3d;
      -o-transform-style: preserve-3d;
      transform-style: preserve-3d;
      /* Application d'une animation sur l'élément .cube.cube1 (qui contient nos faces) */
      -webkit-animation: rotate-cube 15s linear infinite;
      animation: rotate-cube 15s linear infinite;
    }
     
    /** Toutes les faces du cube ont la classe .cube.cube1face
    (plus pratique que d'écrire .cube.cube1 .face:nth-child(1), .cube.cube1 .face:nth-child(2), ...)
    **/
     
    .cube.cube1 img {
      position: absolute;
      width: 150px;
      height: 150px;
      /** Application d'une transition pour
    	avoir un effet d'interpolation entre
    	l'état normal et l'état :hover pour
    	chaque face
    	**/
      -webkit-transition: all 600ms;
      -moz-transition: all 600ms;
      -ms-transition: all 600ms;
      -o-transition: all 600ms;
      transition: all 600ms;
    }
     
     
    /** On déplace chaque face dans l'espace indépendamment,
    pour construire notre cube
    **/
     
    .cube.cube1 .face:nth-child(1) {
      -webkit-transform: translateZ(75px);
      -moz-transform: translateZ(75px);
      -ms-transform: translateZ(75px);
      -o-transform: translateZ(75px);
      transform: translateZ(75px);
    }
     
    .cube.cube1 .face:nth-child(2) {
      -webkit-transform: translateX(75px) rotateY(90deg);
      -moz-transform: translateX(75px) rotateY(90deg);
      -ms-transform: translateX(75px) rotateY(90deg);
      -o-transform: translateX(75px) rotateY(90deg);
      transform: translateX(75px) rotateY(90deg);
    }
     
    .cube.cube1 .face:nth-child(3) {
      -webkit-transform: translateX(-75px) rotateY(-90deg);
      -moz-transform: translateX(-75px) rotateY(-90deg);
      -ms-transform: translateX(-75px) rotateY(-90deg);
      -o-transform: translateX(-75px) rotateY(-90deg);
      transform: translateX(-75px) rotateY(-90deg);
    }
     
    .cube.cube1 .face:nth-child(4) {
      -webkit-transform: translateZ(-75px);
      -moz-transform: translateZ(-75px);
      -ms-transform: translateZ(-75px);
      -o-transform: translateZ(-75px);
      transform: translateZ(-75px);
    }
     
    .cube.cube1 .face:nth-child(5) {
      -webkit-transform: translateY(75px) rotateX(90deg);
      -moz-transform: translateY(75px) rotateX(90deg);
      -ms-transform: translateY(75px) rotateX(90deg);
      -o-transform: translateY(75px) rotateX(90deg);
      transform: translateY(75px) rotateX(90deg);
    }
     
    .cube.cube1 .face:nth-child(6) {
      -webkit-transform: translateY(-75px) rotateX(-90deg);
      -moz-transform: translateY(-75px) rotateX(-90deg);
      -ms-transform: translateY(-75px) rotateX(-90deg);
      -o-transform: translateY(-75px) rotateX(-90deg);
      transform: translateY(-75px) rotateX(-90deg);
    }
     
    /** Si le .cube.cube1 est en :hover, on change la translation de chaque face
    pour qu'elles aillent un peu plus loin, et ainsi donner un
    effet d'explosion du cube
    **/
     
    .cube.cube1.eclate .face:nth-child(1),
    .cube.cube1:hover .face:nth-child(1) {
      -webkit-transform: translateZ(150px);
      -moz-transform: translateZ(150px);
      -ms-transform: translateZ(150px);
      -o-transform: translateZ(150px);
      transform: translateZ(150px);
    }
     
    .cube.cube1.eclate .face:nth-child(2),
    .cube.cube1:hover .face:nth-child(2) {
      -webkit-transform: translateX(150px) rotateY(90deg);
      -moz-transform: translateX(150px) rotateY(90deg);
      -ms-transform: translateX(150px) rotateY(90deg);
      -o-transform: translateX(150px) rotateY(90deg);
      transform: translateX(150px) rotateY(90deg);
    }
     
    .cube.cube1.eclate .face:nth-child(3),
    .cube.cube1:hover .face:nth-child(3) {
      -webkit-transform: translateX(-150px) rotateY(-90deg);
      -moz-transform: translateX(-150px) rotateY(-90deg);
      -ms-transform: translateX(-150px) rotateY(-90deg);
      -o-transform: translateX(-150px) rotateY(-90deg);
      transform: translateX(-150px) rotateY(-90deg);
    }
     
    .cube.cube1.eclate .face:nth-child(4),
    .cube.cube1:hover .face:nth-child(4) {
      -webkit-transform: translateZ(-150px);
      -moz-transform: translateZ(-150px);
      -ms-transform: translateZ(-150px);
      -o-transform: translateZ(-150px);
      transform: translateZ(-150px);
    }
     
    .cube.cube1.eclate .face:nth-child(5),
    .cube.cube1:hover .face:nth-child(5) {
      -webkit-transform: translateY(150px) rotateX(90deg);
      -moz-transform: translateY(150px) rotateX(90deg);
      -ms-transform: translateY(150px) rotateX(90deg);
      -o-transform: translateY(150px) rotateX(90deg);
      transform: translateY(150px) rotateX(90deg);
    }
     
    .cube.cube1.eclate .face:nth-child(6),
    .cube.cube1:hover .face:nth-child(6) {
      -webkit-transform: translateY(-150px) rotateX(-90deg);
      -moz-transform: translateY(-150px) rotateX(-90deg);
      -ms-transform: translateY(-150px) rotateX(-90deg);
      -o-transform: translateY(-150px) rotateX(-90deg);
      transform: translateY(-150px) rotateX(-90deg);
    }
     
    /* ---------------------------- */
    /** animation qui fera tourner le cube **/
    /* ---------------------------- */
    @-webkit-keyframes rotate-cube {
      from {
        -webkit-transform: rotateY(0deg) rotateZ(0deg);
      }
      to {
        -webkit-transform: rotateY(360deg) rotateZ(360deg);
      }
    }
     
    @keyframes rotate-cube {
      from {
        transform: rotateY(0deg) rotateZ(0deg);
      }
      to {
        transform: rotateY(360deg) rotateZ(360deg);
      }
    }
     
    /* ---------------------------- */
    /* effet d'opacité */
    /*
    .cube.cube1 img {
      opacity:0.7;
    }
    .cube.cube1.eclate .face,
    .cube.cube1:hover .face {
      opacity:1;
    }
    */
     
    /* ---------------------------- */
    /* 2eme cube, imbriqué */
    /* ---------------------------- */
    .cube.cube2 {
      position: absolute;
      /*z-index:1;*//*SOUS le 1er*/
      width: 100px;
      height: 100px;
      top: 50%;
      left: 50%;
      margin-left: -50px;
      margin-top: -50px;
      /* Forcer le navigateur à conserver le mode de rendu 3d (ce qui n'est pas le cas par défaut) */
      -webkit-transform-style: preserve-3d;
      -moz-transform-style: preserve-3d;
      -ms-transform-style: preserve-3d;
      -o-transform-style: preserve-3d;
      transform-style: preserve-3d;
      /* Application d'une animation sur l'élément .cube.cube2 (qui contient nos faces) */
      -webkit-animation: rotate-cube 15s linear infinite;
      animation: rotate-cube 15s linear infinite;
    }
     
    .cube.cube2 img {
      position: absolute;
      width: 100px;
      height: 100px;
     
      -webkit-transition: all 600ms;
      -moz-transition: all 600ms;
      -ms-transition: all 600ms;
      -o-transition: all 600ms;
      transition: all 600ms;
    }
     
     
    /** On déplace chaque face dans l'espace indépendamment,
    pour construire notre cube
    **/
     
    .cube.cube2 .face:nth-child(1) {
      -webkit-transform: translateZ(50px);
      -moz-transform: translateZ(50px);
      -ms-transform: translateZ(50px);
      -o-transform: translateZ(50px);
      transform: translateZ(50px);
    }
     
    .cube.cube2 .face:nth-child(2) {
      -webkit-transform: translateX(50px) rotateY(90deg);
      -moz-transform: translateX(50px) rotateY(90deg);
      -ms-transform: translateX(50px) rotateY(90deg);
      -o-transform: translateX(50px) rotateY(90deg);
      transform: translateX(50px) rotateY(90deg);
    }
     
    .cube.cube2 .face:nth-child(3) {
      -webkit-transform: translateX(-50px) rotateY(-90deg);
      -moz-transform: translateX(-50px) rotateY(-90deg);
      -ms-transform: translateX(-50px) rotateY(-90deg);
      -o-transform: translateX(-50px) rotateY(-90deg);
      transform: translateX(-50px) rotateY(-90deg);
    }
     
    .cube.cube2 .face:nth-child(4) {
      -webkit-transform: translateZ(-50px);
      -moz-transform: translateZ(-50px);
      -ms-transform: translateZ(-50px);
      -o-transform: translateZ(-50px);
      transform: translateZ(-50px);
    }
     
    .cube.cube2 .face:nth-child(5) {
      -webkit-transform: translateY(50px) rotateX(90deg);
      -moz-transform: translateY(50px) rotateX(90deg);
      -ms-transform: translateY(50px) rotateX(90deg);
      -o-transform: translateY(50px) rotateX(90deg);
      transform: translateY(50px) rotateX(90deg);
    }
     
    .cube.cube2 .face:nth-child(6) {
      -webkit-transform: translateY(-50px) rotateX(-90deg);
      -moz-transform: translateY(-50px) rotateX(-90deg);
      -ms-transform: translateY(-50px) rotateX(-90deg);
      -o-transform: translateY(-50px) rotateX(-90deg);
      transform: translateY(-50px) rotateX(-90deg);
    }
     
    /* PAS d'éclatement du 2ème cube*/
    /*
    .cube.cube2.eclate .face:nth-child(1),
    .cube.cube2:hover .face:nth-child(1) {
      -webkit-transform: translateZ(100px);
      -moz-transform: translateZ(100px);
      -ms-transform: translateZ(100px);
      -o-transform: translateZ(100px);
      transform: translateZ(100px);
    }
     
    .cube.cube2.eclate .face:nth-child(2),
    .cube.cube2:hover .face:nth-child(2) {
      -webkit-transform: translateX(100px) rotateY(90deg);
      -moz-transform: translateX(100px) rotateY(90deg);
      -ms-transform: translateX(100px) rotateY(90deg);
      -o-transform: translateX(100px) rotateY(90deg);
      transform: translateX(100px) rotateY(90deg);
    }
     
    .cube.cube2.eclate .face:nth-child(3),
    .cube.cube2:hover .face:nth-child(3) {
      -webkit-transform: translateX(-100px) rotateY(-90deg);
      -moz-transform: translateX(-100px) rotateY(-90deg);
      -ms-transform: translateX(-100px) rotateY(-90deg);
      -o-transform: translateX(-100px) rotateY(-90deg);
      transform: translateX(-100px) rotateY(-90deg);
    }
     
    .cube.cube2.eclate .face:nth-child(4),
    .cube.cube2:hover .face:nth-child(4) {
      -webkit-transform: translateZ(-100px);
      -moz-transform: translateZ(-100px);
      -ms-transform: translateZ(-100px);
      -o-transform: translateZ(-100px);
      transform: translateZ(-100px);
    }
     
    .cube.cube2.eclate .face:nth-child(5),
    .cube.cube2:hover .face:nth-child(5) {
      -webkit-transform: translateY(100px) rotateX(90deg);
      -moz-transform: translateY(100px) rotateX(90deg);
      -ms-transform: translateY(100px) rotateX(90deg);
      -o-transform: translateY(100px) rotateX(90deg);
      transform: translateY(100px) rotateX(90deg);
    }
     
    .cube.cube2.eclate .face:nth-child(6),
    .cube.cube2:hover .face:nth-child(6) {
      -webkit-transform: translateY(-100px) rotateX(-90deg);
      -moz-transform: translateY(-100px) rotateX(-90deg);
      -ms-transform: translateY(-100px) rotateX(-90deg);
      -o-transform: translateY(-100px) rotateX(-90deg);
      transform: translateY(-100px) rotateX(-90deg);
    }
    */
    L'imbrication des cubes et la rotation incessante* posent néanmoins un souci pour "accéder" au 2ème cube.
    Sans le z-index sur le premier, on a aussi du mal à accéder au 1er...

    * On peut stopper une animation :
    Code css : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    /* on STOPPE l'animation sur le :hover */
    .cube.cube1:hover {
      -webkit-animation-play-state: paused;
      animation-play-state: paused;
    }
    Dernière modification par Invité ; 02/12/2016 à 15h47.

Discussions similaires

  1. Réponses: 2
    Dernier message: 07/12/2005, 16h26
  2. Insérer une ligne automatiquement dans une autre tab
    Par davyd dans le forum Langage SQL
    Réponses: 10
    Dernier message: 29/03/2005, 17h08
  3. Réponses: 2
    Dernier message: 25/03/2005, 09h23
  4. [XHTML11] Comment insérer une page externe dans une page ?
    Par Invité dans le forum Balisage (X)HTML et validation W3C
    Réponses: 4
    Dernier message: 17/03/2005, 19h43
  5. Comment insérer de l'unicode dans un Richedit ?
    Par DanaKil dans le forum C++Builder
    Réponses: 6
    Dernier message: 30/03/2004, 00h43

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