css3: two transitions with different timing functions (css3)

烂漫一生 提交于 2019-11-29 08:21:05

In this case, I would probably use a wrapper and transition one of the two transforms for the wrapper and the other one for the element itself.

demo

HTML:

<div class='wrap'>
  <div class='el'></div>
</div>

Relevant CSS:

.wrap {
  transition: transform .5s cubic-bezier(.39, -.6, 1, -.6);
}
.el {
  transition: transform .5s cubic-bezier(.27, .875, .575, .87);
}
.wrap:hover { transform: scale(2,2); }
.wrap:hover .el { transform: translateX(-50px); }

Not sure it's a better idea than simulating a translateX by using left.

Another idea would be not to use a transition, but an animation and set the keyframes such that to obtain the desired effect.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!