logo

xDimension (2D,3D…)

2D –  1°

HTML :

<div class="hover2deffect">
    <div class="cube">
        <img src="../../all-css/imgTest/10.jpg" alt="truc">
        <span>CSS</span>
    </div>
    <div class="cube">
        <img src="../../all-css/imgTest/2.jpg" alt="truc">
        <span>Image</span>
    </div>
    <div class="cube">
        <img src="../../all-css/imgTest/8.jpg" alt="truc">
        <span>Hover</span>
    </div>
    <div class="cube">
        <img src="../../all-css/imgTest/3.jpg" alt="truc">
        <span>Effect</span>
    </div>
</div>

CSS :

<style>

    .hover2deffect {
        display: flex;
        width: 100%;
        padding: 4% 2%;
        box-sizing: border-box;
        height: 100vh;
    }

    .cube {
        flex: 1;
        overflow: hidden;
        transition: 0.5s;
        margin: 0 2%;
        box-shadow: 0 20px 30px rgba(0, 0, 0, 0.1);
        line-height: 0;
        padding: 1.25em;
    }

    .cube>img {
        width: 200%;
        height: calc(100% - 10vh);
        object-fit: cover;
        transition: 0.5s;
    }

    .cube>span {
        font-size: 3.8vh;
        display: block;
        text-align: center;
        height: 10vh;
        line-height: 2.6;
    }

    .cube:hover {
        flex: 1 1 50%;
    }

    .cube:hover>img {
        width: 100%;
        height: 100%;
    }
</style>

3D – 1°

HTML :

<div class="start">
    <div class="cube2">
        <img src="../..//all-css/imgTest/4.jpg">
        <img src="../..//all-css/imgTest/4.jpg">
        <img src="../..//all-css/imgTest/4.jpg">
        <img src="../..//all-css/imgTest/4.jpg">
    </div>

CSS :

<style>
    .start {
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .cube2 {
        position: relative;
        width: 360px;
        height: 640px;
        margin-top: 150px;
        background: rgba(0, 0, 0, 0);
        transform: rotate(-30deg) skew(25deg) scale(.8);
        transition: 0.5s;
    }

    .cube2 img {
        position: absolute;
        width: 100%;
        transition: 0.5s;
    }

    .cube2:hover img:nth-child(4) {
        transform: translate(160px, -160px);
        opacity: 1;
    }

    .cube2:hover img:nth-child(3) {
        transform: translate(120px, -120px);
        opacity: .8;
    }

    .cube2:hover img:nth-child(2) {
        transform: translate(80px, -80px);
        opacity: .6;
    }

    .cube2:hover img:nth-child(1) {
        transform: translate(40px, -40px);
        opacity: .4;
    }
</style>

3D – 2°

HTML :

<div class="cube3">
    <div class="visuel">
        <img src="../../all-css/imgTest/8.jpg" class="img" alt="">
    </div>
</div>

CSS :

<style>
    .cube3 {
        width: 100%;
        min-height: 100vh;
    }

    .visuel {
        perspective: 3000px;
        width: 50%;
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        transform-style: preserve-3d;
    }

    .visuel img {
        transform: rotateX(70deg) rotateZ(-60deg) translate3d(-120px, 0px, 70px);
        box-shadow: -80px 60px 15px 5px rgba(0, 0, 0, 0.4);
        transition: all .4s;
        transform-style: preserve-3d;
    }

    .visuel:hover img {
        transform: rotateX(0deg) rotateZ(0deg) translate3d(0px, 0px, 0px);
        box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.0);
    }
</style>

Une idée ? Partagez-la !

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *