Transition animation - css

I am very close to what I want to do but still some problems.
All I want is #sca to come from outside of the div and stays there all the time until page closes and I want this to happen with transition effect very smooth. I also want it to happen without an :focus, :hover, :active events, I want it to happen 2seconds after page opens.
if anybody could help me I would be appreciated.. this is so hard.
#sceneo {width:1200px;height:300px;border:1px solid red;margin:0 auto;}
#scenet {width:650px;height:300px;border:1px solid black;background-color:#FAFAFA;margin:0 auto;}
#sca {float:left;position:relative;left:0;width:271px;height:180px;background: url(http://img521.imageshack.us/img521/7913/123hc.png) no-repeat;display:block;position:relative;right:300px; opacity:0.5;
transition: all 2s;
-moz-transition: all 2s; /* Firefox 4 */
-webkit-transition: all 2s; /* Safari and Chrome */
-o-transition: all 2s; /* Opera */
-webkit-transition-delay:2s;
}
#sca:hover {left:280px;}
<div id="sceneo">
<div id="sca"></div>
<div id="scenet">
</div>

you're almost there! you'll need to create a KEYFRAME animation (as far as I know Opera does not have this yet, but webkit, mozilla, and new IE all support them)
There's a great write up at http://css-tricks.com/snippets/css/webkit-keyframe-animation-syntax/ about how to use keyframes
here's also a quick jsfiddle: http://jsfiddle.net/2wMVR/3/
from there it should be easy!

If you do not want to deal with keyframes, you could use a CSS3 javascript library such as jQuery Transit that handles all the transitions and stuff for you. In my opinion, it is a lot easier than coding CSS3 by hand.
Here is an example that answers your question:
JS Fiddle Demo
Javascript:
$("#sca").transition({ left: '0px', opacity: 1, delay: 2000 }, 2000, 'in');

Related

MS Edge: CSS3 transitions not working as expected in element inside link

I have a link with an element inside (let's call it Bob). Bob is the star of the link, so he wants to shine a bit differently.
The link has some CSS3 transitions to create a fade effect. Bob also has a fade effect, so he can still be the shining element of the link.
An important point is that :hover is related to the container (in the example, a div), and I need it that way.
It works great in Firefox, Chrome and IE, but Microsoft Edge doesn't like the way Bob shines. During the transition, Bob just disappears and I have no idea where he goes.
Here's an example HTML:
<div>
<a href="#1">
<span class="Bob">Bright like a diamond!</span>
<p>Random text</p>
</a>
Other random stuff, who cares...
</div>
The :hover transition is on the div, then both a and Bob have transitions. The relevant CSS is very simple, something like:
div:hover .Bob { transition: all 0.5s ease 0s; }
.Bob { transition: all 0.5s ease 0s; }
div:hover a { transition: all 0.5s ease 0s; }
a { transition: all 0.5s ease 0s; }
Then they just have different colors so you can see the fade animations
Here's a JSFiddle so you can meet Bob:
https://jsfiddle.net/Cthulhu/9vv7v6gd/
If you test it in MS Edge, you will see how Bob disappears during the transition, and we don't want that. If you change the transition times between Bob and a, it gets even weirder, but let's keep it simple for now.
Any ideas?
I had same problem today. I resolved it by more specific transition property
{ transition: all 0.5s ease 0s; }
change to something like
{ transition: color 0.5s ease 0s; }
The way to fix this is by adding the transition result to the element.
div:hover a {
/* for example, if blue text was the desired transition. */
color: blue;
}
This is 2019. Problem has been solved by Microsoft and Edge behaves in this situation just like any other browser.
Case closed.

css rotate with transition seem to affect other elements opacity?

I have this issue with a DIV being rotated with CSS3 transforms using a 1s transition:
In Chrome 23 & Safari 6 on OSX 10.7.5 the font in the other containers gets slightly dimmed, during the .rotate-divs transition.
Any ideas on what causes this and how to avoid it?
http://jsfiddle.net/tTa5r/
.rotate{
background: green;
-moz-transition: all 1s ease;
-webkit-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
.rotate.flip{
-moz-transform: rotate(540deg);
-webkit-transform: rotate(540deg);
-o-transform: rotate(540deg);
transform: rotate(540deg);
}
the flip class is added/removed using jquery:
$('.rotate').on('click', function(){
$(this).toggleClass('flip');
});​
-webkit-backface-visibility: hidden;
also worked for me... adding it to the elements I have transform on
p.s. I would vote the previous answer up but I cant as I dont have enough "reputation", nor can I see how to comment on it
adding
-webkit-backface-visibility: hidden;
to all affected elements, seems to help with that issue: http://jsfiddle.net/tTa5r/2/
while i'm not sure what this property excatly does
it seems to do something to the font rendering:
http://jsfiddle.net/tTa5r/ vs http://jsfiddle.net/tTa5r/2/
...not sure if i dislike that, though.
found here: iPhone WebKit CSS animations cause flicker
The backface-visibility property determines if the element should be visible or not when it's faced away from the screen, commonly used when you "flip" and element.
In this case, it seems that it has the same effect as when you add:
-webkit-transform: translate3d(0,0,0);
Demo - http://jsfiddle.net/tTa5r/4/
which forces hardware acceleration giving you a slightly thinner (anti-aliased), but a more consistent font rendering before and after the transition.
There is a third option as well, and that is to add:
-webkit-font-smoothing: antialiased;
Demo - http://jsfiddle.net/tTa5r/3/
I answered a similar question before and #mddw posted a comment linking to a blog post that describes the methods of antialiasing which seems to be the reason for why you see a differens during and after the transition.
http://cantina.co/2012/05/18/little-details-subpixel-vs-greyscale-antialiasing/
Hope that helps!

Please help! CSS3 glowing transition problems

I am trying to follow this tutorial because I like the effect so much.
CSS Text Glow on Hover with Transition Effects
But the problem is, I set the background color to white.
<style>
.text-glow-hover-with-delay{
background: #FFFFFF;
color: #fff;
transition: text-shadow 3s;
-moz-transition: text-shadow 3s; /* Firefox 4 */
-webkit-transition: text-shadow 3s; /* Safari and Chrome */
-o-transition: text-shadow 3s; /* Opera */
}
.text-glow-hover-with-delay:hover{
text-shadow: 0 0 10px #fff;
}
</style>
<div class="text-glow-hover-with-delay">
Put your mouse over me and I will glow slowly.
</div>
and now it doesn't glow anymore. I'm noob on CSS here. :(
May be you are not able to see the shadow cause its white.
But, its working fine and smoothly. Just reduce the time, 3 seconds are too much.
Here is the working DEMO
OR, if you just want a white shadow See Here
I removed the transition CSS as it seemed to be messing it up and I changed the color tpo black:
http://jsfiddle.net/Ce5SB/
For css transitions you must go from point A to point B.
This means that point A should have a default text-shadow on your default class.
.text-glow-hover-with-delay{
text-shadow:0 0 0 #fff;/*This is the missing piece*/
....
}
With the above missing piece, point B will know where to transition from.
also let me know if the above doesn't work. You may also want to try the transition as
transition:all 300ms ease;/*just in case each browser wants to capture its browser specific text shadow property*/

Is there way to start transition without an event

I am trying to make some kind of animation and I want it to happen without :hover :active or any other event. I want it to happen after 2 second page loads. In fact, I want the object come from invisible place to scene (visible area). Is there anyway of doing it ?
#scene {width:650px;height:300px;border:1px solid black;background-color:#FAFAFA;margin:0 auto;}
#sca {transition: background 2s;width:271px;height:180px;background: url(http://img521.imageshack.us/img521/7913/123hc.png) no-repeat;display:block;position:relative;right:300px; opacity:0.5;
transition: opacity 2s;
-moz-transition: opacity 2s; /* Firefox 4 */
-webkit-transition: opacity 2s; /* Safari and Chrome */
-o-transition: opacity 2s; /* Opera */
transition-delay: 2s;
-webkit-transition-delay: 2s;
}
#sca:hover {opacity:1; }
Yes it's possible, but it's not recommended. How to do it with pure CSS is shown at this site. Here is the demo provided at the site.
A more cross-compatible way of doing it would be using javascript or jQuery, specifically jQuery's ready combined with animation or more generally, effects.
Good luck!
CSS transitions work on events, and there's not any way around that. You'd have to use Javascript to do what you are looking for.
There is difference between transition (from title) and animation (from text). animation can have start without an event, but transition can't.

-webkit- vs -moz-transition

I am using CSS3 transitions on my site and the -webkit- seems to be working, whilst the -moz- is not.
Here is the CSS:
article {z-index: 2; float: left; overflow: hidden; position: relative; -webkit-transition: -webkit-transform 0.2s ease-in-out; -moz-transition: -moz-transform 0.2s ease-in-out; }
.mousedown{-webkit-transform: translate(-180px, 0) !important; -moz-transform: translate(-180px, 0) !important; }
Just using jQuery to add the mousedown class onto the article.
Any idea where I am going wrong?
Firefox 4 and above supports -moz-transition. See the documentation page.
Currently, transitions aren't supported on CSS transforms in Mozilla.
https://developer.mozilla.org/en/CSS/CSS_transitions
Support for -moz-transition has been added in Gecko 1.9.3 (Firefox 3.7), so right now -moz-transition will only work in a Firefox 3.7 alpha release or Minefield (Firefox nightly build).
UPDATE: see comments. Support for -moz-transition has now been added. Yay!
There is no such thing as -moz-transition (yet), sorry. Mozilla will do transforms, but webkit is still the only engine rendering transitions.
opera is supporting it since 10.5, and much better than webkit
CSS transitions, provide a way to control animation speed when changing CSS properties. Instead of having property changes take effect immediately, you can cause the changes in a property to take place over a period of time. For example, if you change the color of an element from white to black, usually the change is instantaneous. With CSS transitions enabled, changes occur at time intervals that follow an acceleration curve, all of which can be customized.

Resources