M
M
Maxim2018-06-12 15:57:21
Angular
Maxim, 2018-06-12 15:57:21

Angular animation. Why is there a sharp instantaneous change in height, and not a smooth one?

Hey! Weak in Angular and JS. I can not understand why there is a sharp change in the height of the cell in the table. When you click on a line, the angular animation is animated. I change the height of the cell and the display property. The pitch changes, but without a smooth transition. It just opens and closes abruptly) But you need to smoothly :)
Thank you :)

animations: [
    trigger('rowVisibleState',
      [
        state('false',
          style({
            height: '0px',
            display: 'none'
          })),
        state('true',
          style({
            height: 'auto',
            display: 'table-cell'
          })),
        transition('0 <=> 1', [
          animate('1000ms ease-in')
        ])
      ]
    )
  ]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2018-06-12
@Tispartaaaa

Can't animate div height from value to auto, must be two values

A
AlexaZem, 2018-06-14
@AlexaZem

You can change the height to auto, only in a different way.
Here is the version that works for me.

state('hidden', style({height: '0px'})),
state('visible', style({height: '*'})),
transition('* => *', animate('255ms ease'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question