CSS3 animation stops to work on gulp --production - css

I hava a laravel project and using laravel elixir for production environment. The gulpfile.js looks like:
const elixir = require('laravel-elixir');
elixir.config.sourcemaps = false;
elixir((mix) => {
mix
.styles('theme/*.css', 'public/css/vendor.css')
.scripts('theme/*.js', 'public/js/vendor.js')
.scripts('custom/*.js', 'public/js/app.js')
.version([
'css/vendor.css',
'js/vendor.js',
'js/app.js',
]);
});
I have a CSS3 animation for heartbit:
.bell {
position: relative;
margin-top: -30px;
}
.bell .heartbit {
position: absolute;
top: -20px;
right: -16px;
height: 25px;
width: 25px;
z-index: 10;
border: 5px solid #ff7676;
border-radius: 70px;
-moz-animation: heartbit 1s ease-out;
-moz-animation-iteration-count: infinite;
-o-animation: heartbit 1s ease-out;
-o-animation-iteration-count: infinite;
-webkit-animation: heartbit 1s ease-out;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
.bell .point {
width: 6px;
height: 6px;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
background-color: #ff7676;
position: absolute;
right: -6px;
top: -10px;
}
#-moz-keyframes heartbit {
0% {
-moz-transform: scale(0);
opacity: 0.0;
}
25% {
-moz-transform: scale(0.1);
opacity: 0.1;
}
50% {
-moz-transform: scale(0.5);
opacity: 0.3;
}
75% {
-moz-transform: scale(0.8);
opacity: 0.5;
}
100% {
-moz-transform: scale(1);
opacity: 0.0;
}
}
#-webkit-keyframes heartbit {
0% {
-webkit-transform: scale(0);
opacity: 0.0;
}
25% {
-webkit-transform: scale(0.1);
opacity: 0.1;
}
50% {
-webkit-transform: scale(0.5);
opacity: 0.3;
}
75% {
-webkit-transform: scale(0.8);
opacity: 0.5;
}
100% {
-webkit-transform: scale(1);
opacity: 0.0;
}
}
The animation works fine. But, when I run gulp --production, it stops to work. I tried manually minifying the css file from https://cssminifier.com/curl and the animation still works, even with the minified file. But, somehow it fails only on gulp --production What am I missing here? What should I look into?

You defined #-moz and #-webkit- for your heartbit animation but you forgot to define the standard keyframe for it. Some minifiers remove the prefixed declarations so you are left with no animation declaration at all.

Related

Ambigram and Palindrome CSS animation

So today is a special date ... 🙂
Both Ambigram and Palindrome!
I tried to make CSS that would demonstrate this, but I have some issues:
There is a small jump between the end of the rotate and the original place of the text.
In the first half of the animatoin (from 0% to 50%) the Palindrome should be demonstrated. Do not know how to do such animation. There are all kinds of options, for example video of 02/02/2020 https://thumbs.gfycat.com/GroundedReliableInchworm-mobile.mp4
#import url('https://fonts.googleapis.com/css2?family=Dhurjati&family=Qahiri&display=swap');
.rotate{
color: rgb(22 02 2022);
width: 100%;
font-size: 100px;
text-align: center;
font-family: Dhurjati, Qahiri;
position: absolute;
animation: rotate 10s linear infinite 0s;
-ms-animation: rotate 10s linear infinite 0s;
-webkit-animation: rotate 10s linear infinite 0s;
}
.move1 {
margin-left: 10px;
}
.move2 {
margin-left: 30px;
}
#-moz-keyframes rotate{
50% { opacity: 1; -moz-transform: rotate(0deg); }
100% { opacity: 1; -moz-transform: rotate(180deg); }
}
#-webkit-keyframes rotate{
50% { opacity: 1; -webkit-transform: rotate(0deg); }
100% { opacity: 1; -webkit-transform: rotate(180deg); }
}
#-ms-keyframes rotate{
50% { opacity: 1; -ms-transform: rotate(0px); }
75% { opacity: 1; -ms-transform: rotate(180px); }
}
<div class="rotate">22<span class="move1">02<span><span class="move2">2022</span></div>

Removing class in HTML is not capturing correct CSS styling

Using Bootstrap as my default CSS, I also created a custom .css file I made that creates a loading screen when my webpage is processing the information. Basically, my loading screen is hiding in the background and I use javascript to bring it to the front for any triggers.
Here is the CSS code:
#loading-page.loading {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1000;
}
#loading-page.loading #loading-page-icon {
display: block;
position: relative;
left: 50%;
top: 50%;
width: 150px;
height: 150px;
margin: -75px 0 0 -75px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #3498db;
z-index: 1001;
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
}
#loading-page.loading #loading-page-icon:before {
content: "";
position: absolute;
top: 5px;
left: 5px;
right: 5px;
bottom: 5px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #e74c3c;
-webkit-animation: spin 3s linear infinite;
animation: spin 3s linear infinite;
}
#loading-page.loading #loading-page-icon:after {
content: "";
position: absolute;
top: 15px;
left: 15px;
right: 15px;
bottom: 15px;
border-radius: 50%;
border: 3px solid transparent;
border-top-color: #f9c922;
-webkit-animation: spin 1.5s linear infinite;
animation: spin 1.5s linear infinite;
}
#-webkit-keyframes spin {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg)
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg)
}
}
#keyframes spin {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg)
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg)
}
}
#loading-page.loading .loading-curtain {
position: fixed;
top: 0;
width: 51%;
height: 100%;
background: #5c5c5c;
z-index: 1000;
}
#loading-page.loading .loading-curtain.section-left {
left: 0;
}
#loading-page.loading .loading-curtain.section-right {
right: 0;
}
/* Once the page loads */
#loading-page:not(.loading) {
visibility: hidden;
-webkit-transform: translateY(-100%);
-ms-transform: translateY(-100%);
transform: translateY(-100%) -webkit-transition: all 0.3s 1s ease-out;
transition: all 0.3s 1s ease-out;
}
#loading-page:not(.loading) #loading-page-icon {
opacity: 0;
-webkit-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
#loading-page:not(.loading) .loading-curtain.section-left {
-webkit-transform: translateX(-100%);
-ms-transform: translateX(-100%);
transform: translateX(-100%);
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}
#loading-page:not(.loading) .loading-curtain.section-right {
-webkit-transform: translateX(100%);
-ms-transform: translateX(100%);
transform: translateX(100%);
-webkit-transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: all 0.7s 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
}
Here is my HTML
<body>
<div id="loading-page">
<div id="loading-page-icon"></div>
<div class="loading-curtain section-left"></div>
<div class="loading-curtain section-right"></div>
</div>
...[other html code]
</body>
And then here is my Javascript I use to remove the class on my div#loading-page
$(document).ready(function() {
/*
When a page fully loads, remove the .loading class
*/
$('#loading-page')
.removeClass('loading')
})
$(document).on(
"submit",
[
'form.search',
],
function() {
/*
Event Listener- anytime the search form is submitted, display the
loading screen.
*/
$('#loading-page')
.addClass('loading')
})
The only problem I have with my CSS code is for some reason, my transition animation will not work (where you see 'Once the page loads' comment in .css) - as if I performed a .hide() on #loading-page than removing the class. I'm pretty sure the CSS is getting ignored. I even tried to force the styling by trying to use the :not('loading') operator. Besides the animation not working, the loading screen does pop up and then goes away once the document is ready as expected. Any help why my CSS is getting ignored?
Thank you
Adding and removing .loading toggles the visibility property - which can't be transitioned. Something is either hidden or not. If you want to fade in the element, use opacity, and possibly pointer-events so the invisible-but-still present element doesn't capture click events.

CSS Animation in Internet Explorer

The following code will display a CSS animated 'pulsing' circle.
In works in all browsers but not in Internet explorer.
How can I make it work in Internet Explorer?
Codepen: http://codepen.io/danest/pen/GxfqB/
#container {
margin-top: 20px;
margin-left: 30px;
position: relative;
background: #45453f;
}
.pulse {
width: 10px;
height: 10px;
border: 5px solid #f7f14c;
-webkit-border-radius: 30px;
-moz-border-radius: 30px;
border-radius: 30px;
background-color: #716f42;
z-index: 10;
position: absolute;
}
.dot {
border: 10px solid #fff601;
background: transparent;
-webkit-border-radius: 60px;
-moz-border-radius: 60px;
border-radius: 60px;
height: 50px;
width: 50px;
-webkit-animation: pulse 3s ease-out;
-moz-animation: pulse 3s ease-out;
animation: pulse 3s ease-out;
-webkit-animation-iteration-count: infinite;
-moz-animation-iteration-count: infinite;
animation-iteration-count: infinite;
position: absolute;
top: -25px;
left: -25px;
z-index: 1;
opacity: 0;
}
#-moz-keyframes pulse {
0% {
-moz-transform: scale(0);
opacity: 0.0;
}
25% {
-moz-transform: scale(0);
opacity: 0.1;
}
50% {
-moz-transform: scale(0.1);
opacity: 0.3;
}
75% {
-moz-transform: scale(0.5);
opacity: 0.5;
}
100% {
-moz-transform: scale(1);
opacity: 0.0;
}
}
#-webkit-keyframes "pulse" {
0% {
-webkit-transform: scale(0);
opacity: 0.0;
}
25% {
-webkit-transform: scale(0);
opacity: 0.1;
}
50% {
-webkit-transform: scale(0.1);
opacity: 0.3;
}
75% {
-webkit-transform: scale(0.5);
opacity: 0.5;
}
100% {
-webkit-transform: scale(1);
opacity: 0.0;
}
}
Maybe this site can help you : http://caniuse.com/
there is a page dedicate for complex method of animating certain properties of an element : http://caniuse.com/#feat=css-animation
With the help of previous answers I solved this (Thank you)
I needed to add the 'modern' keyframes without prefix. This works in IE 10
#keyframes pulse {
0% {
transform: scale(0);
opacity: 0.0;
}
25% {
transform: scale(0);
opacity: 0.1;
}
50% {
transform: scale(0.1);
opacity: 0.3;
}
75% {
transform: scale(0.5);
opacity: 0.7;
}
100% {
transform: scale(1.2);
opacity: 0.0;
}
}

Can't get CSS3 animation to work on my website

I'm trying to get a bouncing mouse animation to work on my website.
The exact same code works on another website, whereas on mine it just doesn't do anything.
Here's the css:
.mouse {
display: block;
margin: 0 auto;
text-align: center;
width: 100%;
font-size: 32px;
color: #fff;
z-index:9999;
position: absolute;
color: #e8e8e8;;
bottom: 240px;
}
.mouse i {
-webkit-animation: todown 1.2s infinite linear;
transition: all 0.3s ease-in-out;
}
The HTML:
<a href="#x11" class="mouse">
<i class="fa fa-angle-double-down icon-option"></i>
</a>
On this website you can see the scrolldown icon I'm trying to create: http://noxxar.com/demo/uralco/
If you want to use CSS animations you need to define #keyframes.
Luckily the CSS on the theme you linked isn't minified or anything, so you can just copy/paste the parts you want to recreate.
Since Firefox 15 the -moz vendor prefix isn't needed but Chrome and other Webkit Browser still need -webkit-animation: http://caniuse.com/#feat=css-animation
CSS:
#to-slider-scrollto i {
-webkit-animation: todown 1.2s infinite linear;
animation: todown 1.2s infinite linear;
}
#to-slider-scrollto i:hover {
-webkit-animation: none;
animation: none;
}
#-webkit-keyframes todown {
0% {
-webkit-transform: translateY(-15px);
opacity: 0;
}
10% {
-webkit-transform: translateY(-15px);
opacity: 0;
}
50% {
-webkit-transform: translateY(0);
opacity: 1;
}
90% {
-webkit-transform: translateY(15px);
opacity: 0;
}
100% {
-webkit-transform: translateY(15px);
opacity: 0;
}
}
#keyframes todown {
0% {
transform: translateY(-15px);
opacity: 0;
}
10% {
transform: translateY(-15px);
opacity: 0;
}
50% {
transform: translateY(0);
opacity: 1;
}
90% {
transform: translateY(15px);
opacity: 0;
}
100% {
transform: translateY(15px);
opacity: 0;
}
}
Working codepen demo with only the needed CSS
Check out cross browser compatibility
.mouse i {
-webkit-animation: todown 1.2s linear infinite;
animation: todown 1.2s linear infinite;
}
#-webkit-keyframes todown {
0% {
-webkit-transform: translateY(0px);
transform: translateY(0px);
}
50% {
-webkit-transform: translateY(5px);
transform: translateY(5px);
}
}
#keyframes todown {
0% {
-webkit-transform: translateY(0px);
transform: translateY(0px);
}
50% {
-webkit-transform: translateY(5px);
transform: translateY(5px);
}
}

CSS3 spinner, preloader

I would like to build a animated spinner with CSS3.
It should behave like this :
After the last state it should start again like in the first state.
I managed to create circles using the technique explained here : stackoverflow question
Now, how can I animate the spinner between the described states? I do not know how to animate the clip-rect property. I also guess that it would behave better with a clip-poly instead (a triangle maybe) but I can't animate that either.
CSS3 spinner
This CSS preloader uses keyframe animations and transform-rotate CSS3 properties to make the circle and the filling color.
This spinner is responsive.
.sp1 {
margin: 50px auto;
position: relative;
width: 30%;
padding-bottom: 30%;
overflow: hidden;
background-color: #557733;
border-radius: 50%;
z-index: 1;
}
.sp:before,
.sp:after {
content: '';
position: absolute;
height: 100%;
width: 50%;
background-color: #99FF33;
}
.sp1:after {
width: 80%;
height: 80%;
margin: 10%;
border-radius: 50%;
background-color: #fff;
z-index: 6;
}
.sp1:before {
background-color: inherit;
z-index: 5;
}
.sp2:before {
z-index: 4;
-webkit-animation: spin1 3s linear infinite;
animation: spin1 3s linear infinite;
-webkit-transform-origin: 100% 50%;
transform-origin: 100% 50%;
}
.sp2:after {
opacity: 0;
right: 0;
z-index: 6;
-webkit-animation: spin2 3s linear infinite;
animation: spin2 3s linear infinite;
-webkit-transform-origin: 0 50%;
transform-origin: 0 50%;
}
#-webkit-keyframes spin1 {
0% { -webkit-transform: rotate(0deg); }
50%, 100% { -webkit-transform: rotate(180deg); }
}
#keyframes spin1 {
0% { transform: rotate(0deg); }
50%, 100% { transform: rotate(180deg); }
}
#-webkit-keyframes spin2 {
0% { -webkit-transform: rotate(0deg); opacity: 0; }
49.99% { opacity: 0; }
50% { -webkit-transform: rotate(0deg); opacity: 1; }
100% { -webkit-transform: rotate(180deg); opacity: 1;
}
}
#keyframes spin2 {
0% { transform: rotate(0deg); opacity: 0; }
49.99% { opacity: 0; }
50% { transform: rotate(0deg); opacity: 1; }
100% { transform: rotate(180deg); opacity: 1; }
}
<div class="sp sp1">
<div class="sp sp2"></div>
</div>
Fiddle demo

Resources