Guest User

Untitled

a guest
Apr 3rd, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. .allElements {
  2.   transform:translate(0%) scale(1);
  3.   transition:0.5s transform ease;
  4. }
  5. That way, we can give the element an active class, like this, which tells it to slide right and grow when it's active:
  6. .active {
  7.   transform:translate(100%) scale(1.5);
  8. }
  9. When applied to the elements, it overwrites the first transform. The elements would slide 100% of their width, from their natural left, to the right.
  10.  
  11. The challenge I saw with some of the SVGs recently, was that the SVGs were using transform to declare their natural position. like this:
  12. .exampleElement1 {
  13.   transform:translate(30px);
  14. }
  15. .exampleElement2 {
  16.   transform:translate(80px);
  17. }
  18. Now, we cannot use our animation transform. Once we apply transform on these elements, it will overwrite the transform that was used to position them. They would lose their natural position, and instead of sliding from their 30 or 80px, would slide from 0px.
  19.  
  20. It is possible to write unique animations for each of the elements, like:
  21. .exampleElement1Active {
  22.   transform:translate(30px) translate(100%) scale(1.5);
  23. }
  24. .exampleElement2Active {
  25.   transform:translate(80px) translate(100%) scale(1.5);
  26. }
  27. However, that's a lot of extra code. We've worked with SVGs for many years now, and we've always been able to get them without transforms used in their positioning.
Add Comment
Please, Sign In to add comment