I am working on this demo. How can I add or reduce 90 degree to the .box
linear-gradient with animation based on the #anim-left
or #anim-right
click?
I was able to add some CSS but this is jumping on changing the degree
$("#anim-left").on("click", function() {
$('.box').toggleClass('box-reverse');
// setInterval(function(){ }, 1);
// $(this).css({
// background: "linear-gradient(90"+90+"deg, #fff 50%, #ffe600 50%)"
// });
});
$("#anim-right").on("click", function() {
$('.box').toggleClass('box-reverse');
// setInterval(function(){ }, 1);
// $(this).css({
// background: "linear-gradient(90"+90+"deg, #fff 50%, #ffe600 50%)"
// });
});
.box {
height: 120px;
width: 120px;
background: linear-gradient(90deg, red 50%, blue 50%);
transition: all 3s ease-in-out;
}
.box-reverse {
background: linear-gradient(270deg, red 50%, blue 50%);
transition: all 3s ease-in-out;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="box"></div>
<button id="anim-left"> Animate To Left </button>
<button id="anim-right"> Animate To Right </button>