0

I have an array that gets constantly updated, for every new entry I want to animate it. So I wrote this function:

animateUserInput() {
    let userMsgLength = document.getElementsByClassName('usermessage').length;
    let lastElement;
    setTimeout(() => {
        lastElement = document.getElementsByClassName('usermessage')[userMsgLength];
        if(lastElement){
            const myAnimation = this.builder.build([
                sequence([
                    animate('200ms 500ms ease-out', style({
                        opacity: 0,
                        top:'-120px'
                    })), animate('0ms 101ms',style({
                        fontSize: 16,
                        textAlign: 'right',
                        top: '-100px'
                    })),
                    animate('0ms 100ms ease-in',style({
                        opacity: 1,
                        top:'-130px'
                    }))
                ])

            ]);

            // then create a player from it
            const player = myAnimation.create(lastElement);

            player.play();
        }

    }, 0)

}

If I compile this with Ionic serve, it will work just fine. But If I build it on my devie (iPhone) the animation won't work. I've been trying for hours and don't know what to do anymore. Any suggestions?

Sivvio
  • 297
  • 2
  • 7
  • 22
  • Hey man, I think when it comes to Ionic you should either stick with animation provided by Angular or leverage CSS animations. its unclear based on your example what library / tech stack is underneath your example – Sergey Rudenko Aug 01 '18 at 03:02
  • hey Serjey, I'm using Angular animations. – Sivvio Aug 01 '18 at 10:11
  • Got it, so what is your iOS version? did you rule out browser support? not all the browsers yet support angular animations – Sergey Rudenko Aug 01 '18 at 17:17

1 Answers1

0

You may need the polyfill for safari which I don't believe supports web animations api at the moment.

radek79
  • 43
  • 9