Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using from or to in CSS animations will break transformation #2854

Closed
giovannipiller opened this issue Feb 2, 2017 · 1 comment
Closed
Milestone

Comments

@giovannipiller
Copy link
Contributor

Description:

Code like the following:

  @keyframes someAnimation {
    from {
      transform: scale3d(1.5,1.5,1) rotate(0deg);
    }

    50% {
      transform: scale3d(1,1,1) rotate(90deg);
    }

    to {
      transform: scale3d(1.5,1.5,1) rotate(0deg);
    }
  }

Will be wrongly converted to the following. Notice the [data-ractive-css] attributes;

@keyframes someAnimation {
    from[data-ractive-css~="{328a91fd-7095-2748-09c4-42b189b78cb8}"], [data-ractive-css~="{328a91fd-7095-2748-09c4-42b189b78cb8}"] from {
      transform: scale3d(1.5,1.5,1) rotate(0deg);
    }

    50% {
      transform: scale3d(1,1,1) rotate(90deg);
    }

    to[data-ractive-css~="{328a91fd-7095-2748-09c4-42b189b78cb8}"], [data-ractive-css~="{328a91fd-7095-2748-09c4-42b189b78cb8}"] to {
      transform: scale3d(1.5,1.5,1) rotate(0deg);
    }
  }

In the meantime, a workaround to this is using 0% and 100% rather than from or to, in your CSS animations.

Versions affected:

tested on 0.8.10 and edge

Reproduction:

https://jsfiddle.net/7qxqrkks/1/

@MartinKolarik
Copy link
Member

This recently popped up in sveltejs/svelte#245 as well. I'll check if there's a reasonable way to fix this in Ractive.

@Rich-Harris did make a good point though - keyframe declarations are global, so unless we can use a different transformation strategy to make them scoped, it might be better to simply put them in a separate (global) css file.

MartinKolarik added a commit that referenced this issue Feb 10, 2017
Better CSS at-rules handling (fixes #2854)
@evs-chris evs-chris added this to the 0.8.11 milestone Feb 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants