Smooth continuous CSS animation blob flow - css

I am trying to make a lively blob that blobs smoothly around the shape's plane. However, when I make this approach, the blob is very rigid and the flow of 0-25-50-75-100 can be directly seen in the animation. I am guessing this is because of the ease-in-out transition but I am not sure what to do next. I have tried linear, ease-in, ease-out, and ease-in-out but they are all very choppy
What should I change to make it a smoother animated blob?
.shape-container{
display: flex;
align-items: center;
justify-content: center;
height:100vh;
}
.shape{
width: 400px;
height: 400px;
background: linear-gradient(64deg, #f34868 23%, #f24768 23%, #9e00ec 80%);
animation: blob 8s ease-in-out infinite;
}
#keyframes blob {
0%, 100% {
border-radius:65% 100% 80% 100%
}
25% {
border-radius:100% 80% 100% 65%
}
50% {
border-radius:80% 100% 65% 100%
}
75% {
border-radius:100% 65% 100% 80%
}
}
<div class="shape-container">
<div class="shape"/>
</div>
[UPDATE] This is the 2nd blob I tried, this blob also does not smoothly rotate around, it just goes back and forth
.shape-container{
display: flex;
align-items: center;
justify-content: center;
height:100vh;
}
.shape{
width: 400px;
height: 400px;
background: linear-gradient(64deg, #f34868 23%, #f24768 23%, #9e00ec 80%);
animation: blob 8s ease-in-out infinite;
}
#keyframes blob {
0%, 100% {
border-radius:24% 76% 35% 65% / 27% 36% 64% 73%
}
25% {
border-radius:76% 24% 33% 67% / 68% 55% 45% 32%
}
}
<div class="shape-container">
<div class="shape"/>
</div>

I would have another look at the linear animation timing function because it has the same speed from start to end. Also if you combine the blob animation with a rotate animation you don't easily get the idea there is a pattern in the entire animation.
* {
margin: 0;
padding: 0;
}
.shape-container{
display: flex;
align-items: center;
justify-content: center;
height:100vh;
background-color: #222;
}
.shape{
width: 400px;
height: 400px;
background: linear-gradient(64deg, #f34868 23%, #f24768 23%, #9e00ec 80%);
border-radius: 28% 72% 22% 78% / 39% 23% 77% 61%;
transform: rotate(0deg);
will-change: border-radius, transform;
animation: blob 10s linear infinite, spin 100s linear infinite;
}
#keyframes blob {
0%, 100% {
border-radius: 28% 72% 22% 78% / 39% 23% 77% 61%;
}
50% {
border-radius: 72% 28% 50% 50% / 55% 26% 74% 45%;
}
}
#keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(359deg);
}
}
<div class="shape-container">
<div class="shape"/>
</div>

Related

clip-path is not animating?

WHAT I HAVE
I have a div (class = circle), I set key-fames for 4s so that it nicely animates from triangle to octagon.
body {
background-color: #252525;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
}
.circle {
width: 30rem;
height: 5rem;
background-color: #1c7ed6;
animation: wave--animate 4s infinite ease-in-out alternate;
}
#keyframes wave--animate {
0% {
/* triangle */
clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
100% {
/* octagon */
clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
}
}
<body>
<section class="section--water-waves">
<p class=circle></p>
</section>
</body>
WHAT I NEED
but, it immediately changes to octagon, instead of nicely and slowly getting animated to octagon...

CSS reverse morphing animation on hover

i have circle element animating on my page, what i try to do is to smoothly transition it on hover, to be just a square with it original size: 200px x 200px. And also, on mouse leave to smoothly back to previous (morphing) state. Any ideas? Heres my code:
a {
width: 200px;
height: 200px;
display: flex;
justify-content: center;
align-items: center;
background: #333;
color: #fff;
border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
animation: morphing ease-in-out 10s infinite;
}
a:hover {
}
#keyframes morphing {
0% {
border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
}
25% {
border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%;
}
50% {
border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;
}
75% {
border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%;
}
}
<a>sample text</a>
Ok, so here it goes. On mouseover, we start the morphing animation. On mouseout, we set the border radius to start position.
You can play with duration (which is in milliseconds) as per your liking.
let elem = document.querySelector("a");
let morphAnim = elem.getAnimations()[0];
elem.addEventListener("mouseover", () => {
elem.animate(morphAnim.effect.getKeyframes(), {
easing: "ease-in-out",
duration: 10000,
iterations: Infinity,
iterationStart: 0.1
})
})
elem.addEventListener("mouseout", () => {
elem.animate({
borderRadius: "30% 70% 70% 30% / 30% 30% 70% 70%"
}, {
duration: 1000,
fill: "forwards",
iterations: 1
});
})
a {
width: 200px;
height: 200px;
display: flex;
justify-content: center;
align-items: center;
background: #333;
color: #fff;
border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
animation: morphing ease-in-out 10s infinite;
animation-play-state: paused;
}
#keyframes morphing {
0% {
border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
}
25% {
border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%;
}
50% {
border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;
}
75% {
border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%;
}
}
<a>sample text</a>

Add a pause between loops of an animation

I've got this animation that I want to add a pause in between its loops / iterations. I've tried doing it with animation-delay but that of course only applies for the first iteration. Now I've set the animation to take up 3s to make it a bit slower and not spam as much but It would be neat with a pause in between. Any ideas on how to best achieve this?
This is the code:
.--bounce {
-moz-animation: bounce 3s infinite;
-webkit-animation: bounce 3s infinite;
animation: bounce 3s infinite;
}
#keyframes bounce {
0%, 20%, 50%, 80%, 100% {
transform: translateY(0);
}
40% {
transform: translateY(-30px);
}
60% {
transform: translateY(-15px);
}
}
Make pause a part of your animation - in the snippet below the actual animation takes 50% of bounce, the rest is pause.
body {
margin: 0;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.box {
width: 100px;
height: 100px;
border: 1px solid black;
background-color: lime;
}
.--bounce {
-moz-animation: bounce 6s infinite;
-webkit-animation: bounce 6s infinite;
animation: bounce 6s infinite;
}
#keyframes bounce {
0%,
10%,
25%,
40%,
50% {
transform: translateY(0);
}
20% {
transform: translateY(-30px);
}
30% {
transform: translateY(-15px);
}
}
<div class="box --bounce"></div>

How to give wiggle animation effect with fixed position?

I want an element to be animated like a swaying plant. I am looking to animate a div in the following manner.
Fix the bottom
Move the head back and forth
Looking for full css solution.
I have tried this,
#keyframes wiggle {
0% {
transform: rotate(0deg);
}
25% {
transform: rotate(-1deg);
}
50% {
transform: rotate(2deg);
}
75% {
transform: rotate(-0.4deg);
}
100% {
transform: rotate(1deg);
}
}
You can set transform-origin property to bottom.
.el {
margin: 30px 50px;
width: 0;
height: 0;
border-style: solid;
border-width: 150px 50px 0 50px;
border-color: #007bff transparent transparent transparent;
animation: wiggle infinite 3s alternate;
transform-origin: bottom;
}
#keyframes wiggle {
0% {transform: rotate(0deg);}
25% {transform: rotate(-3deg);}
50% {transform: rotate(5deg);}
75% {transform: rotate(-1deg);}
100% {transform: rotate(2deg);}
}
<div class="el"></div>

how to apply gradient animation effects in react component

how to make use of gradient animation effects like this in react component in-line. I have to make use of below CSS based gradient animation effects as inline in react component. Is there any specific package(s) available for that?
body {
width: 100wh;
height: 90vh;
color: #fff;
background: linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB);
background-size: 400% 400%;
-webkit-animation: Gradient 15s ease infinite;
-moz-animation: Gradient 15s ease infinite;
animation: Gradient 15s ease infinite;
}
#-webkit-keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
#-moz-keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
#keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
h1,
h6 {
font-family: 'Open Sans';
font-weight: 300;
text-align: center;
position: absolute;
top: 45%;
right: 0;
left: 0;
}
Take a look at this:
https://codepen.io/anon/pen/BYvVqP
I just used a state to store the classes.
className={this.state.animationClass}

Resources