Skip to content

AnimationPlayer.getPosition always returns zero #18891

@marcusbelcher

Description

@marcusbelcher

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

AnimationPlayer.getPosition() always returns 0

Expected behavior

getPosition() should return the current 0% of the animation inferred in the API docs

Minimal reproduction of the problem with instructions

Create an Animation programatically such as:


createAnimation(){
  let a = this._builder.build([
    animate('1000ms', keyframes([
      style({ transform: 'translate3d(0px, 0px, 0px)', offset: 0.0 }),
      style({ transform: 'translate3d(100px, 0px, 0px)', offset: 1.0 }),
    ]))
  ]);
  this.animationPlayer = a.create(this.domNode);
  this.animationPlayer.play();
  setTimeout(this.pauseAnimation.bind(this), 500);//half animation time
}

pauseAnimation(){
  this.animationPlayer.pause();
  console.log(this.animationPlayer.getPosition());//excepting ~50 to be printed
}

Live example

Environment


Angular version: 4.3.6
@angular/cli: 1.3.2

Browser:
- [x] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: 8.1.4
- Platform:  Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: animationsfreq2: mediumtype: bug/fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions