Skip to content

CSS transitions of transforms are not smooth #7783

Closed

Description

@paulrouget

We are trying to build a sidebar that moves from the right of the window (offscreen) to cover the content, with a CSS transition, but it's very choppy.

Here is a slowed down screencast (had to use my camera, the screencast software doesn't show the progressive painting):

enormouscircularkillifish

<style>
  div {
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    height: 100vh;
    background: rgba(255,0,0,1);
    transform: translateX(500px);
    transition: transform 400ms linear;
  }

  .show div {
    transform: translateX(1px);
  }
</style>

<p>
  Hey, what kinda party is this? There's no booze and only one hooker. This is the worst part. The calm before the battle. What's with you kids? Every other day it's food, food, food. Alright, I'll get you some stupid food. Hey, you add a one and two zeros to that or we walk! We're rescuing ya. And then the battle's not so bad?
</p>

<div>
</div>


<script>
  document.body.addEventListener('keypress', e => {
    if (e.charCode == 97) { // a
      document.body.classList.toggle('show');
    }
  });
</script>

Activity

  1. paulrouget commented on Sep 29, 2015

    @paulrouget
    ContributorAuthor

    Is this a regression or transition on transforms are not properly optimized yet?

  2. pcwalton commented on Sep 29, 2015

    @pcwalton
    Contributor

    They should be working. We'll need to dive into what exactly the problem is here.

    (Though it could just be the lack of DLBI.)

  3. notriddle commented on Sep 29, 2015

    @notriddle
    Contributor

    What's DLBI?

  4. metajack commented on Sep 29, 2015

    @metajack
    Collaborator
  5. pcwalton commented on Sep 30, 2015

    @pcwalton
    Contributor

    Also WebRender might just fix this issue for good

  6. paulrouget commented on Oct 1, 2015

    @paulrouget
    ContributorAuthor

    Tried with WebRender. Animation is not smoother.

  7. glennw commented on Oct 1, 2015

    @glennw
    Member

    We looked into this and (at least for the webrender case) it's just that vsync wasn't enabled and it was tearing. I imagine that would fix the normal renderer case too, since it's such a simple transition it shouldn't take long to paint that.

  8. paulrouget commented on Oct 1, 2015

    @paulrouget
    ContributorAuthor

    @glennw figured it was because vsync was not used on osx. Adding with_vsync() to the glutin window improves the performance quiet a lot. PR: #7812

  9. added a commit that references this issue on Oct 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions