Skip to content

this.oldElement doesn't have intermediate transition values #62

@samselikoff

Description

@samselikoff

Just curious if you've seen this before. I'm trying out this simple inline transition

this.transition(
  this.hasClass('hello-world'),
  this.use(function() {
    debugger;
    let duration = 5000;
    if (this.oldElement) {
      stop(this.oldElement);
      duration = timeSpent(this.oldElement, 'fade-in');
    }

    if (this.oldElement) {
      return animate(this.oldElement, { opacity: 0 }, { duration });
    } else {
      return animate(this.newElement, { opacity: 1 }, { duration }, 'fade-in');
    }
  })
)

with a simple toggle

{{#if showHello}}
  {{#liquid-wormhole class="hello-world"}}
    Hello, World!
  {{/liquid-wormhole}}
{{/if}}

The transition is being matched & run, but I'm noticing that if I click the button then click it again, there is a this.oldElement, but I don't get it with its transitioning values. In other words, if the opacity is at 0.33 when I click the button the second time, in normal Liquid Fire situations I would be able to see that (and thus smoothly transition from the intermediate state back to the initial state). But here I think something is being re-rendered, because this.oldElement doesn't have any of those intermediate values.

Any idea why, or is that re-rendering behavior an expected part of the implementation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions