html - Can we perform multiple transformations on an element through different animations? -
in css apply multiple transformations same element in 1 rule must written this: .selector{ transform:translatey( *value* ) scale( *value*) rotatez(*value*)
etc. how add multiple transformations in multiple animations? example:
@import 'https://necolas.github.io/normalize.css/latest/normalize.css'; /* //////////////////////////////// initial //////////////////////////////// */ html, body{ height:100% } body{ background:#eee } #btncont{ display:block; width:100px; height:100px; margin:0 auto; position:relative; transform:translatey(-50%); top:50%; perspective:1000px } #btn { width:100%; height:100%; background:#333; color:#eee; border:0; outline:0; text-transform:uppercase; transform:rotatex(93deg) translatex(0); transform-origin:bottom } /* //////////////////////////////// __anim_ //////////////////////////////// */ .rotup{ animation-name:rotateup; animation-duration:1s; animation-fill-mode:forwards } .movup{ animation-name:moveup; animation-duration:1.5s; animation-fill-mode:forwards } @keyframes rotateup{ 0%{ transform:rotatex(93deg) } 100%{ transform:rotatex(0deg) } } @keyframes moveup{ 0%{ transform:translatex(0) } 100%{ transform:translatex(95px) } }
<div id="btncont"> <button id="btn" class="rotup movup">button</button> </div>
i want perform rotateup
, moveup
simultaneously. now, rotateup
gets ignored.
transform can take more 1 rule/value @ once. can mix values , add many steps wish.
basicly:
@import 'https://necolas.github.io/normalize.css/latest/normalize.css'; /* //////////////////////////////// initial //////////////////////////////// */ html, body{ height:100% } body{ background:#eee } #btncont{ display:block; width:100px; height:100px; margin:0 auto; position:relative; transform:translatey(-50%); top:50%; perspective:1000px } #btn { width:100%; height:100%; background:#333; color:#eee; border:0; outline:0; text-transform:uppercase; transform:rotatex(93deg) translatex(0); transform-origin:bottom } /* //////////////////////////////// __anim_ //////////////////////////////// */ .rotup.movup{ animation-name:anim; animation-duration:1.5s; animation-fill-mode:forwards } @keyframes anim{ 0%{ transform:rotatex(93deg) translatex(0) } 75%{ transform:rotatex(25deg) translatex(90px) } 100%{ transform:rotatex(0deg) translatex(95px) } }
<div id="btncont"> <button id="btn" class="rotup movup">button</button> </div>
Comments
Post a Comment