Mirror but keep translation stable
P粉680087550
P粉680087550 2024-02-17 17:45:11
0
1
481

When I flip the image, the transformation is also done: the translation is in the opposite direction. How to achieve mirroring of the current translation position?

img {
  transform: translate(50px, 100px);
  /* scale:-1; */
}
<img class="draggable" src="https://cdn.pixabay.com/photo/2016/03/28/12/35/cat-1285634__340.png" width=200>

Since the image is being dragged using a function and the transform is dynamically updated, expect to find a different solution than this one -> Transform: translate(50px, 100px) scale(-1);

P粉680087550
P粉680087550

reply all(1)
P粉909476457

You don't really need the transform-property anymore, as far as I know you can do this:

img {
  translate: 50px 100px;
  scale: -1 1;
}

scale The property takes up to 3 values, corresponding to 3 axes (x,y,z). If only 1 value is provided, that value will be used for both the x- and y-axes. That's why you can assign it values, the first one for the x-axis and the second one for the y-axis.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template