Resize logic to maintain a fixed corner after rotate in javascript

前端 未结 1 1042
被撕碎了的回忆
被撕碎了的回忆 2021-01-07 02:27

How to calculate or logic behind to get translate x & y while resize(with one fixed corner) after rotate.

Below image shows corner based resize

1条回答
  •  借酒劲吻你
    2021-01-07 03:16

    You could just set a transform-origin using CSS so you don't have to calculate the translate to compensate :

    .box{transform-origin: 0 100% 0;}
    

    Link to W3C doc

    Example on jsfiddle

    0 讨论(0)
提交回复
热议问题