I'm working on some basic FreeCodeCamp challenges, and I'm trying to use React Transition Group to achieve some pretty simple animations. Here's the CodePen.
What I've run in to is that I can't find out how to have the "quote card" horizontally and vertically centered, and also have my animations (that I'm using React Transition Group to trigger) perform a translation on it. I have the element that I'm trying to move (#quote-box
) centered with the following css:
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
Here're the "move" CSS classes that I'm using with the Transition Group:
.move-enter {
opacity: 0.01;
transform: translate(-200px, 0);
}
.move-enter-active {
opacity: 1;
transform: translate(0, 0);
transition: all 500ms ease-in 200ms;
}
.move-exit {
opacity: 1;
transform: translate(0, 0);
}
.move-exit-active {
opacity: 0.01;
transform: translate(200px, 0);
transition: all 500ms ease-in 200ms;
}
I assume that I should be setting the transition
properties to be left
instead of all
, but I'm a little lost in what is preventing the movement from happening. Should I also have a move-exited
and move-entered
class with the appropriate positioning? Thanks in advance!