Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

fix($animate): make CSS blocking optional for class-based animations #6841

Closed
wants to merge 1 commit into from

Conversation

matsko
Copy link
Contributor

@matsko matsko commented Mar 25, 2014

$animate attempts places a transition: none 0s block on the element when
the first CSS class is applied if a transition animation is underway. This
works fine for structural animations (enter, leave and move), however, for
class-based animations, this poses a big problem. As of this patch, instead
of $animate placing the block, it is now the responsibility of the user to
place transition: 0s none into their class-based transition setup CSS class.
This way the animation will avoid all snapping and any will allow $animate to
play nicely with class-based transitions that are defined outside of ngAnimate.

Closes #6674
Closes #6739

BREAKING CHANGE: Any class-based animation code that makes use of transitions
and uses the setup CSS classes (such as class-add and class-remove) must now
provide a empty transition value to ensure that its styling is applied right
away. In other words if your animation code is expecting any styling to be
applied that is defined in the setup class then it will not be applied
"instantly" default unless a transition:0s none value is present in the styling
for that CSS class. This situation is only the case if a transition is already
present on the base CSS class once the animation kicks off.

@mary-poppins
Copy link

Hey Matias

@Narretz
Copy link
Contributor

Narretz commented Mar 25, 2014

Dies it make sense to add docunentation for this change?

@matsko
Copy link
Contributor Author

matsko commented Mar 25, 2014

I am currently working on that.

@matsko
Copy link
Contributor Author

matsko commented Mar 25, 2014

It will be in the same commit.

var state = isRoot ? rootAnimateState : (parentElement.data(NG_ANIMATE_STATE) || {});
var result = state.disabled || state.running
? true
: state.last && !state.last.isClassBased;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you indent this the way we indent all the other ternary operators in angular code base?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@IgorMinar
Copy link
Contributor

please add docs, otherwise looks good

@IgorMinar IgorMinar modified the milestones: 1.3.0-beta.4, 1.3.0 Mar 25, 2014
* <h3>CSS Staggering Animations</h3>
* ### Structural transition animations
*
* Structural transitions (such as enter, leave and move) will always apply a `none 0s` transition
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it more common to say 0s none instead of none 0s?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing.

@matsko matsko added cla: yes and removed cla: no labels Mar 26, 2014
$animate attempts places a `transition: none 0s` block on the element when
the first CSS class is applied if a transition animation is underway. This
works fine for structural animations (enter, leave and move), however, for
class-based animations, this poses a big problem. As of this patch, instead
of $animate placing the block, it is now the responsibility of the user to
place `transition: 0s none` into their class-based transition setup CSS class.
This way the animation will avoid all snapping and any will allow $animate to
play nicely with class-based transitions that are defined outside of ngAnimate.

Closes angular#6674
Closes angular#6739

BREAKING CHANGE: Any class-based animation code that makes use of transitions
and uses the setup CSS classes (such as class-add and class-remove) must now
provide a empty transition value to ensure that its styling is applied right
away. In other words if your animation code is expecting any styling to be
applied that is defined in the setup class then it will not be applied
"instantly" default unless a `transition:0s none` value is present in the styling
for that CSS class. This situation is only the case if a transition is already
present on the base CSS class once the animation kicks off.
@matsko
Copy link
Contributor Author

matsko commented Mar 26, 2014

MERGED

@matsko
Copy link
Contributor Author

matsko commented Mar 26, 2014

Landed as 1bebe36

@matsko matsko closed this Mar 26, 2014
@matsko matsko deleted the ng_class_fix branch March 26, 2014 16:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.