The illusion of movement

By changing the display of the elements immediately before and after the transition, we can create the illusion that a single element is moving across the screen and into a different part of the DOM.

// set the stage so ramjet copies the right styles...
{{to}}.classList.remove('hidden');

ramjet.transform( {{from}}, {{to}}, {
  done: function () {
    // this function is called as soon as the transition completes
    {{to}}.classList.remove('hidden');
  }
});

// ...then hide the original elements for the duration of the transition
a.classList.add('hidden');
b.classList.add('hidden');
a