Reputation: 1094
I have gotten a css animation arrow the is pointed left to right and it works as expected- the animation also works fine. I am trying to change the direction of this arrow so that is points from right to left. I have tried to change the before and after elements but this does not seem to change the direction of the arrow?
body {
background: black;
}
.the-arrow {
width: 64px;
transition: all 0.2s;
}
.the-arrow.-left {
position: absolute;
top: 60%;
left: 0;
}
.the-arrow.-left .shaft {
width: 0;
background-color: #999;
}
.the-arrow.-left .shaft:before,
.the-arrow.-left .shaft:after {
width: 0;
background-color: #999;
}
.the-arrow.-left .shaft:before {
-webkit-transform: rotate(0);
transform: rotate(0);
}
.the-arrow.-left .shaft:after {
-webkit-transform: rotate(0);
transform: rotate(0);
}
.the-arrow.-right {
top: 3px;
}
.the-arrow.-right .shaft {
width: 64px;
transition-delay: 0.2s;
}
.the-arrow.-right .shaft:before,
.the-arrow.-right>.shaft:after {
width: 8px;
transition-delay: 0.3s;
transition: all 0.5s;
}
.the-arrow.-right .shaft:before {
-webkit-transform: rotate(40deg);
transform: rotate(40deg);
}
.the-arrow.-right .shaft:after {
-webkit-transform: rotate(-40deg);
transform: rotate(-40deg);
}
.the-arrow .shaft {
background-color: #fff;
display: block;
height: 1px;
position: relative;
transition: all 0.2s;
transition-delay: 0;
will-change: transform;
}
.the-arrow .shaft:before,
.the-arrow .shaft:after {
background-color: #fff;
content: '';
display: block;
height: 1px;
position: absolute;
top: 0;
right: 0;
transition: all 0.2s;
transition-delay: 0;
}
.the-arrow .shaft:before {
-webkit-transform-origin: top right;
transform-origin: top right;
}
.the-arrow .shaft:after {
-webkit-transform-origin: bottom right;
transform-origin: bottom right;
}
.animated-arrow {
display: inline-block;
color: #fff;
font-size: 12px;
text-decoration: none;
position: relative;
transition: all 0.2s;
}
.animated-arrow:hover {
color: #eaeaea;
}
.animated-arrow:hover .the-arrow.-left .shaft {
width: 64px;
transition-delay: 0.1s;
background-color: #eaeaea;
}
.animated-arrow:hover .the-arrow.-left .shaft:before,
.animated-arrow:hover .the-arrow.-left .shaft:after {
width: 8px;
transition-delay: 0.1s;
background-color: #eaeaea;
}
.animated-arrow:hover .the-arrow.-left .shaft:before {
-webkit-transform: rotate(40deg);
transform: rotate(40deg);
}
.animated-arrow:hover .the-arrow.-left .shaft:after {
-webkit-transform: rotate(-40deg);
transform: rotate(-40deg);
}
.animated-arrow:hover .main {
-webkit-transform: translateX(80px);
transform: translateX(80px);
}
.animated-arrow:hover .main .the-arrow.-right .shaft {
width: 0;
-webkit-transform: translateX(200%);
transform: translateX(200%);
transition-delay: 0;
}
.animated-arrow:hover .main .the-arrow.-right .shaft:before,
.animated-arrow:hover .main .the-arrow.-right .shaft:after {
width: 0;
transition-delay: 0;
transition: all 0.1s;
}
.animated-arrow:hover .main .the-arrow.-right .shaft:before {
-webkit-transform: rotate(0);
transform: rotate(0);
}
.animated-arrow:hover .main .the-arrow.-right .shaft:after {
-webkit-transform: rotate(0);
transform: rotate(0);
}
.animated-arrow .main {
display: flex;
align-items: center;
transition: all 0.2s;
}
.animated-arrow .main .text {
margin: 0 16px 0 0;
line-height: 1;
font-family: 'Montserrat';
text-transform: uppercase;
}
.animated-arrow .main .the-arrow {
position: relative;
}
<div class="pivot-arrows-1" style="">
<a class="animated-arrow arrow-c-f" href="#">
<span class="the-arrow -left">
<span class="shaft"></span>
</span>
<span class="main">
<span class="text">
Link Text
</span>
<span class="the-arrow -right">
<span class="shaft"></span>
</span>
</span>
</a>
</div>
Upvotes: 3
Views: 4355
Reputation: 519
I did not understand which one you want to rotate but you can apply a rotation to the whole element
.the-arrow.-left {
transform: rotate(180deg);
}
.the-arrow.-right {
transform: rotate(180deg);
}
If you want rotate the arrow in general just
.the-arrow {
transform: rotate(180deg);
}
Upvotes: 4