Reputation: 5859
Can someone help create an animation with an image that starts of like a door is open on the left where the translation-origin-x is on the right side of the image and when you hover over it - it closes like a door. What I have doesn't quite work and the image disappears can someone perfect it for me here is a link to a jsFiddle and if possible could you make it start with keyframes so when it loads that page starts the animation straight away instead of hover animation
here is my css:
body > section > header > #section-logo {
-webkit-perspective:300px;
-webkit-transform-style:preserve-3d
}
body > section > header > #section-logo img{
margin-right:80px;
-webkit-transform-style: preserve-3d;
-webkit-transition: -webkit-transform 1s;
-webkit-transform-origin-x:100%;
-webkit-transform: rotateY(-45deg) translateX(0px)
}
body > section > header > #section-logo:hover img {
-webkit-transform:rotateY(-0deg)
}
and the Html:
<section>
<header>
<div id="section-logo">
<img id="" alt="" src="Images/shop_departments_large.png" width="163" height="155" />
</div>
</header>
</section>
Upvotes: 1
Views: 443
Reputation: 494
UPDATED The door closes onetime on page load & remains closed. Check this: http://jsfiddle.net/error007/NL5Mn/5/
@-webkit-keyframes swingd {
0% { -webkit-transform: rotateY(-50deg); }
100% { -webkit-transform: rotateY(0deg); }
/*
50% { -webkit-transform: rotateY(0deg); }
100% { -webkit-transform: rotateY(-50deg); }
*/
}
#section-logo {
-webkit-transform-style: preserve-3d;
-webkit-perspective:300px;
}
#section-logo img{
margin-right:80px;
-webkit-transform-style: preserve-3d;
-webkit-transition: -webkit-transform 1s;
-webkit-transform-origin: 100% 0%;
-webkit-transform: rotateY(0deg);
/*-webkit-animation: swingd 2s infinite ; */
-webkit-animation: swingd 3s 1;
}
#section-logo:hover img {
-webkit-transform: rotateY(0deg);
}
Upvotes: 2