css - what does scale3d() function really do? -


scale3d(sx, sy, sz)

i can't understand scale3d() when change (sz) value

in below code can see value of (sz) = 1

body{perspective:600px}  div{      width: 300px;      height: 300px;      background-color: burlywood;      margin: auto;      border-radius:40px;      transition: 5s ease-in-out;      transform: scale3d(1,1,1)  }
<div></div>

in below code can see value of (sz) = 0.5

but nothing changed same result

body{perspective:600px}  div{      width: 300px;      height: 300px;      background-color: burlywood;      margin: auto;      border-radius:40px;      transition: 5s ease-in-out;      transform: scale3d(1,1,0.5)  }
<div></div>

note : tried solutions & values nothing happened

the third number in scale3d z-axis, applicable three-dimensional shapes.

your examples have perspective, they're still use two-dimensional shapes, nothing happens.

you can see effect true cube:

scale3d(1,1,1)

#wrapper {    perspective: 1200px;    width: 200px;    height: 200px;    margin: 80px auto;  }  #cube {    width: 100%;    height: 100%;    position: absolute;    transform-style: preserve-3d;    transform: rotatex(45deg) rotatey(0deg) rotatez(45deg) scale3d(1, 1,1);    transition: transform 1s;  }  #cube>div {    width: 100%;    height: 100%;    position: absolute;    display: flex;  }  #cube>div span {    margin: auto;    font-size: 50px;  }  #left {    background-color: rgba(25, 25, 112, 0.7);    transform: rotatey(-90deg) translatez(100px);  }  #right {    background-color: rgba(47, 79, 79, 0.7);    transform: rotatey(90deg) translatez(100px);  }  #front {    background-color: rgba(119, 136, 153, 0.7);    transform: rotatey(0deg) translatez(100px);  }  #back {    background-color: rgba(72, 61, 139, 0.7);    transform: rotatex(180deg) translatez(100px);  }  #top {    background-color: rgba(0, 128, 128, 0.7);    transform: rotatex(90deg) translatez(100px);  }  #bottom {    background-color: rgba(70, 130, 180, 0.7);    transform: rotatex(-90deg) translatez(100px);  }
<div id="wrapper">    <div id="cube">      <div id="left"><span>left</span></div>      <div id="right"><span>right</span></div>      <div id="front"><span>front</span></div>      <div id="back"><span>back</span></div>      <div id="top"><span>top</span></div>      <div id="bottom"><span>bottom</span></div>    </div>  </div>

scale3d(1,1,0.5)

#wrapper {    perspective: 1200px;    width: 200px;    height: 200px;    margin: 50px auto;  }  #cube {    width: 100%;    height: 100%;    position: absolute;    transform-style: preserve-3d;    transform: rotatex(45deg) rotatey(0deg) rotatez(45deg) scale3d(1,1,0.5);    transition: transform 1s;  }  #cube > div {    width: 100%;    height: 100%;    position: absolute;    display: flex;  }  #cube > div span {    margin: auto;    font-size: 50px;  }  #left {    background-color: rgba(25,25,112,0.7);    transform: rotatey(-90deg) translatez(100px);  }  #right {    background-color: rgba(47,79,79,0.7);    transform: rotatey(90deg) translatez(100px);  }  #front  {    background-color: rgba(119,136,153,0.7);    transform: rotatey(0deg) translatez(100px);  }  #back {    background-color: rgba(72,61,139,0.7);    transform: rotatex(180deg) translatez(100px);  }  #top {    background-color: rgba(0,128,128,0.7);    transform: rotatex(90deg) translatez(100px);  }  #bottom {    background-color: rgba(70,130,180,0.7);    transform: rotatex(-90deg) translatez(100px);  }
<div id="wrapper">    <div id="cube">      <div id="left"><span>left</span></div>      <div id="right"><span>right</span></div>      <div id="front"><span>front</span></div>      <div id="back"><span>back</span></div>      <div id="top"><span>top</span></div>      <div id="bottom"><span>bottom</span></div>    </div>  </div>


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -