How to delay background animation - css

I want that the background animation I have set will start in delay.
Here is the fiddle link: Fiddle link
Here is the css code:
.loginButton {
width: 92%;
background: #ffffff;
border: 1px solid #4dbcb8 !important;
margin-top: 30px;
height: 42px;
line-height: 40px;
position: absolute;
top: 132px;
color: #14192f !important;
border-radius: 3px !important;
font-size: 12pt !important;
letter-spacing: 0.05em;
font-weight: 600;
}
.loginButton:hover {
color: #fff !important;
font-weight: 400 !important;
transition: background .7s ease-out;
background: linear-gradient(to right, #fff 50%, #4dbcb8 50%);
background-position: right bottom;
background-size: 200% 100%;
}

Just add a second time parameter as the delay time:
transition: background .7s .5s ease-out;
This will cause a 500ms delay.

Add this line to your .loginButton CSS:
animation-delay: 2s;

div {
width: 100px;
height: 100px;
background: red;
position: relative;
-webkit-animation: mymove 5s infinite; /* Chrome, Safari, Opera */
-webkit-animation-delay: 2s; /* Chrome, Safari, Opera */
animation: mymove 5s infinite;
animation-delay: 2s;
}
/* Chrome, Safari, Opera */
#-webkit-keyframes mymove {
from {left: 0px;}
to {left: 200px;}
}
#keyframes mymove {
from {left: 0px;}
to {left: 200px;}
}
Html
<div>
</div>
Please check this link:http://www.w3schools.com/cssref/tryit.asp?filename=trycss3_animation-delay

Related

CSS animation works differently when properties specified separately

I have following CSS for animating two separate elements:
.loading-icon,
.loading-icon-2{
height: 50px;
position: relative;
left: 50%;
top: 30%;
transform: translateXY(-50%, 50%);
}
.loading-icon {
display: flex;
border: 16px solid #f3f3f3; /* Light grey */
border-top: 16px solid #3498db; /* Blue */
border-radius: 50%;
width: 60px;
height: 60px;
text-align: center;
animation-name: spin;
animation-duration: 2s;
transition-timing-function: linear;
animation-iteration-count: infinite;
animation: spin 2s linear infinite;
}
.loading-icon-2 {
display: flex;
border: 16px solid #f3f3f3; /* Light grey */
border-top: 16px solid #3498db; /* Blue */
border-radius: 50%;
width: 60px;
height: 60px;
text-align: center;
animation-name: anotherspin;
animation-duration: 2s;
transition-timing-function: linear;
animation-iteration-count: infinite;
}
.loading-icon div,
.loading-icon-2 div {
margin: auto;
}
#keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
#keyframes anotherspin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
The only difference is that for the loading-icon-2 class all the animation properties have been specified separately instead of using the shorthand style.
But both the elements are behaving differently. Could someone please help understand why this is happening or am I missing something here.
See the code working here at CodePen.
The difference is that you're using transition-timing-function: linear instead of animation-timing-function: linear. When you use the shorthand, though, it implicitly employs the correct property name, making the animation look continuous with no easing.

Why my animation is not active?

hello i want to make my background move but the animation is not active. Why ?
#keyframes anima {
0% {
background-position-y: 0px;
} 100% {
background-position-y: -150px;
}
}
#bando {
border-radius: 4px;
background-image: url(neon.jpg);
background-size: 130%;
width: 600px;
padding-top:40px;
padding-bottom:40px;
margin-bottom: 10px;
font-size: 30px;
height:150px;
animation-name: anima;
animation-delay: 2s;
animation-iteration-count: infinite;
animation-timing-function: linear;
animation-direction: alternate-reverse;
}
Thanks in advance to help me because I am blocked on it since 4 hours
try this in https://jsfiddle.net/526vttyg/
You're missing an animation-duration, and you have to specify that, otherwise the animation won't do anything. The default animation-duration is 0
https://developer.mozilla.org/en-US/docs/Web/CSS/animation-duration
#bando {
border-radius: 4px;
background-image: url(http://kenwheeler.github.io/slick/img/fonz1.png);
background-size: 130%;
width: 600px;
padding-top: 40px;
padding-bottom: 40px;
margin-bottom: 10px;
font-size: 30px;
height: 150px;
animation-name: anima;
animation-duration: 2s;
animation-delay: 2s;
animation-iteration-count: infinite;
animation-timing-function: linear;
animation-direction: alternate-reverse;
}
#keyframes anima {
0% {
background-position-y: 0;
}
100% {
background-position-y: -150px;
}
}
<div id="bando"></div>

CSS Animation "slide in from side" not working on Chrome

I'm a little new to CSS animations, to apologies if this is a silly question :) I have the following HTML:
<div class="slideToView" rel="{{product}}">
<div class="info" rel="{{product}}">
Info
</div>
<div class="remove" rel="{{product}}">
Remove
</div>
<div style="clear:both"></div>
</div>
...and the following CSS:
/* slider option */
.slideToView {
z-index: 1000000;
background: green;
position: absolute;
right: -200px;
top: 0px;
width: 200px;
}
.slideToView.visible {
transition: 1.5s;
right: 5px;
-webkit-animation: slide 0.5s forwards;
-webkit-animation-delay: 1.5s;
animation: slide 0.5s forwards;
animation-delay: 1.5s;
}
.slideToView.dohide {
transition: 1s;
right: -200px;
-webkit-animation: slide 0.5s backwards;
-webkit-animation-delay: 1s;
animation: slide 0.5s backwards;
animation-delay: 1s;
}
.slideToView .info {
float: left;
width: 50%;
background: #b0b6bb;
line-height: 100px;
color: white;
text-align: center;
font-weight: bold;
border-left: 1px solid #95ACBF;
box-sizing: border-box;
}
.slideToView .remove {
float: left;
width: 50%;
background: #ff0000;
line-height: 100px;
color: white;
text-align: center;
font-weight: bold;
}
#-webkit-keyframes slide {
100% { left: 0; }
}
#keyframes slide {
100% { left: 0; }
}
/* end slider options */
If I run the code in Firefox, it works fine:
However, in Chrome it slides out ok - but then it goes to the left of the page:
As I said, I'm quite new to using CSS animations - but AFAIK I have everything right.
You can see a basic example of this happening here:
https://jsfiddle.net/unbmajwv/3/
Thanks for your time!
Add dohide class to slideToView in the html. And add opacity: 0 to the .slideToView class and opacity: 1 to the .slideToView.visible class.
Updated the fiddle: https://jsfiddle.net/unbmajwv/4/

Using :hover to trigger #keyframes animation when the element uses multiple animations

I have a set of icons that transition from the center of the page to a set point, and then remain there. What I want to do is set them to transition to have a thicker border and scale to 130x130px whenever I mouse over one of them, but only the initial animation occurs
CSS:
.iconborder {
border-width: 5px;
border-style: solid;
border-radius: 100em;
border-color: white;
}
.iconborder:hover {animation-name: icongrow; animation-duration: 0.2s; animation-timing-function: cubic-bezier;}
#keyframes icongrow {
0% {
border-width: 5px;
width: 100px;
height: 100px;
}
100% {
border-width: 10px;
width: 130px;
height: 130px;
}
}
#FTPSlideOut
{
position: fixed;
width: 100px;
height: 100px;
left: 50%;
top: 50%;
margin-left: -50px;
margin-top: -50px;
z-index: 6;
visibility: hidden;
animation-name: FTPSlideOut;
animation-duration: 0.4s;
animation-timing-function: cubic-bezier;
animation-delay: 1s;
animation-fill-mode: forwards;
}
#keyframes FTPSlideOut {
0% {
transform: translate(0px, 0px);
visibility: visible;
}
100% {
transform: translate(-300px, -150px);
visibility: visible;
}
}
And HTML:
<body style="background-color:#D4D4D4;height:100%;width:100%">
<img id="SlideUp" class="dropshadow" src="picCenterDotFinalwText.png">
<img id="FTPSlideOut" class="dropshadow iconborder" src="FTP.png">
<img id="PicturesSlideOut" class="dropshadow iconborder" src="Pictures.png">
<img id="VideosSlideOut" class="dropshadow iconborder" src="Videos.png">
<img id="MusicSlideOut" class="dropshadow iconborder" src="Music.png">
<img id="DocumentsSlideOut" class="dropshadow iconborder" src="Documents.png">
<img id="EmailSlideOut" class="dropshadow iconborder" src="Email.png">
</body>
Any clues?
Im not sure why are you using keyframes for just a simple hover animation.
You can use css3 transitions just for that animation
see demo
#-webkit-keyframes icongrow {
0%{
border-width: 5px;
width: 100px;
height: 100px;
}
100% {
border-width: 10px;
width: 130px;
height: 130px;
border-color:#ccc;
}
}
.iconborder{
text-align:center;
border: solid 5px #fff; /* use shorthand */
border-radius: 100em;
/* customize */
-webkit-transition : border 0.2s linear;
/*-webkit-animation-duration: 0.2s;*/
}
.iconborder:hover{
border: 10px solid #fff;
width: 130px;
height: 130px;
cursor:pointer;
/* -webkit-animation-name: icongrow;
-webkit-animation-fill-mode: forwards;*/
}
#-webkit-keyframes FTPSlideOutAnimate {
0%{
opacity:0;
-webkit-transform: translate(0,0);
}
100% {
opacity:1;
-webkit-transform: translate(-300px, -150px);
}
}
#FTPSlideOut{
position: fixed;
width: 100px;
height: 100px;
left: 50%;
top: 50%;
margin-left: -50px;
margin-top: -50px;
z-index: 6;
/* customize */
opacity:0.1;
-webkit-transition: -webkit-transform 1s ease-in,
opacity 0.5s linear;
}
#FTPSlideOut:hover{
-webkit-transform: translate(-300px, -150px);
opacity:1;
/*-webkit-animation: FTPSlideOutAnimate 0.2s linear;
-webkit-animation-fill-mode: forwards; */
}
http://jsfiddle.net/phcba/2/
in that fiddle you can uncomment the keyframes properties just to check and see how bad the animation it was when using Keyframes if not done right for your hover effect
Also im not sure how the #FTPSlideOut is position and displayed on your site, so I made it barely visible in that demo. Ive used Opacity instead of visibilty, you'll need to modify it in your case.
For more info about CSS3 transtions:
http://css-tricks.com/almanac/properties/t/transition/
cheers
Just put your animation in the class pseudo selector with the hover in it? like this
.clickMes {
color: white;
font-size: 17pt;
text-decoration: none;
}
.clickMes:active {
color: cyan;
}
.clickMes:hover {
animation: clickmes 1.3s infinite;
}
#keyframes clickmes {
0% {
background-color: none;
}
50% {
background-color: cyan;
}
100% {
background-color: none;
}
}

Pulsing dot in CSS Chrome display issue

I'm trying to create a pulsing dot effect with CSS.
HTML markup is simple:
<span class="map-pin pulse dark">
<span></span>
</span>
The CSS is like this:
#-webkit-keyframes pulse{
0%{
opacity:1;
width: 16px;
height: 16px;
}
50% {
opacity:.5;
-webkit-transform: scale(3);
}
100%{
opacity: 0;
}
}
#-moz-keyframes pulse{
0%{
opacity:1;
width: 16px;
height: 16px;
}
50% {
opacity:.5;
-moz-transform: scale(3);
}
100%{
opacity: 0;
}
}
.pulse{
width: 32px;
height: 32px;
background: none;
display: inline-block;
position: relative;
vertical-align: middle;
line-height: 16px;
text-align: center;
}
.pulse>*{
position: relative;
border:1px solid #fa565a;
width: 16px;
height: 16px;
display: inline-block;
vertical-align: middle;
text-indent: -9000px;
-webkit-border-radius:30px;
-moz-border-radius:30px;
border-radius:30px;
-webkit-transition-property:top, bottom, left, right, opacity, border-width;
-webkit-animation-duration:2s;
-webkit-animation-name:pulse;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: cubic-bezier(0,0,0,1);
-moz-transition-property:top, bottom, left, right, opacity, border-width;
-moz-animation-duration:2s;
-moz-animation-name:pulse;
-moz-animation-iteration-count: infinite;
-moz-animation-timing-function: cubic-bezier(0,0,0,1);
}
.pulse.dark>*{
border-color: #fa565a;
}
.pulse:after{
content: '';
display: block;
position:absolute;
width: 16px;
height: 16px;
left: 8px;
top: 2px;
-webkit-border-radius:10px;
-moz-border-radius:10px;
border-radius:10px;
background: #2B6882;
vertical-align: middle;
}
.pulse.dark:after{
background: #fa565a;
-webkit-box-shadow: none;
-moz-box-shadow: none;
}
It display OK in firefox, but in Chrome, the circle border, that should pulse, is heavily pixelated. That border is the empty span inside pulse span.
I'm looking at it for almost an hour and can't find what could be the problem.
Without the "text-indent: -9000px", it works slightly better.
Fiddle.
.pulse>*{
position: relative;
border:1px solid #fa565a;
width: 16px;
height: 16px;
display: inline-block;
vertical-align: middle;
-webkit-border-radius:30px;
-moz-border-radius:30px;
border-radius:30px;
-webkit-transition-property:top, bottom, left, right, opacity, border-width;
-webkit-animation-duration:2s;
-webkit-animation-name:pulse;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: cubic-bezier(0,0,0,1);
-moz-transition-property:top, bottom, left, right, opacity, border-width;
-moz-animation-duration:2s;
-moz-animation-name:pulse;
-moz-animation-iteration-count: infinite;
-moz-animation-timing-function: cubic-bezier(0,0,0,1);
}

Resources