VueConf US


1. State of Vue

Evan You

2. How We Do Vue At GitLab

Jacob Schatz

3. Vue in Motion

Rachel Nabors

4. Testing Vue apps

Edd Yerburgh
Notify me when new talks are available.

Vue in Motion

Vue in Motion

Rachel Nabors

Rachel Nabors is the cultivator of the Web Animation community, author of Animation at Work, a Google Developer Expert, invited expert at the W3C, and has helped clients build motion design into their user interfaces.

She believes that animation is a necessary part of a complete and balanced user experience because it helps convey information visually that could otherwise bog down the human brain.

Vue’s Transition Element

After summarizing CSS transitions, Rachel introduces how Vue handles transitions, with its transition element, which allows the adding of entering and leaving transitions to any element or component.

When you assign a name to a transition element, it creates these name-spaced CSS classes:

  • enter
  • enter-to
  • enter-active
  • leave
  • leave-to
  • leave-active

She explains how there is a separate lifecycle for when the element enters the page and when it leaves the page. Each lifecycle has an initial state (enter / leave) and an ending state (enter to / leave to). The actual transition is added with enter-active and leave-active.

However, she recommends not using enter-to or leave and instead putting the default state in the original CSS class. This way, if animation is not supported, the default state will still be shown.

Transition Group

Next, Rachel introduces the transition-group element, which can wrap multiple elements and gives an additional class called move, which is used with the FLIP animation technique. Her recommendation here is to set a unique key when using multiple elements within a transition group.

Managing Toggling Elements

She goes on to discuss transition modes, which determine the order of animations, and how you can use in-out and out-in to design how these elements enter and leave in relation to each other.

JavaScript Animation Hooks

As her talk progresses, Rachel discusses JavaScript animation hooks using the Web Animation API. The transition element has a set of JavaScript hooks such as leave, enter, etc., and Rachel demonstrates how you can use them to trigger a function with Vue’s v-on directive, and she shows how you can use the Web Animation API’s animate method.

Pro Tip: she says to make sure to set v-bind:css="false" when animating with JavaScript to avoid conflicts and performance issues. This means you have to tell Vue when the animation has ended, which she shows how to do.

Accessible Animations

UI animation can cause negative side effects for some users, such as:

  • Seizures caused by flashing and blinking
  • Nausea triggered by parallax motion
  • Distraction and fatigue brought on by looping animation

In her talk, Rachel walks through how to adjust animation code to make it accessible.