Have been banging my head against the wall for two days now, and went so far as to debug the JS code for the WebAnimationsPlayer class in the platform-browser module. Here are my findings so far:
#1 the player won't start playing until you call .play() on the AnimationPlayer object returned from Renderer.animate()
#2 I sense a potential bug in the WebAnimationsPlayer class, whereby as soon as the animation is finished, the player destroys itself unless there's some sort of "parentPlayer" which is a field/property on the class and which remains empty when we call Renderer.animate(). And that's cool, however in the course of self-destruction, WebAnimationsPlayer calls the reset() method on the internal player of the element, which essentially reverts the styles you'd want left alone at the end of your animation, and returns the element to its original state. - NOT GOOD!
Please note: WebAnimationsPlayer does properly set 'fill':'both' which instructs the element player to maintain its final state in both directions, but that doesn't help anyways due to the explicit reset() call.
This is what I've been struggling with and the only resolve seems to be the direct use of renderer.invokeElementMethod as pointed out later by the OP.
BTW, the WebAnimationsPlayer class called by Renderer.animate() uses it internally anyways.
My code currently goes like this, and seems to work for me:
this._renderer.invokeElementMethod(
element.nativeElement,
'animate',
[
[
{top : 0, left: 0, offset : 0},
{top : `${offsetY}px`, left : `${offsetX}px`, offset : 1}
],
{
delay: 1000,
duration: 5000,
iterations: 1,
easing: 'ease',
fill: 'both'
}
]
);
#3 Please note that in the OP-s code, the delay and duration values are in milliseconds, so given the "reset" problem described in #2 he would not have been able to notice any animation even if .play() had been called.