我需要将箭头放在鱼的右下角,放在我的脸部。我制作了这两个单独的图像,因为当鼠标悬停在箭头上时,我希望箭头从0度移动到270度。
我已经让动画工作但现在我有点卡在如何将它放在我的音阶中。这是移动的第一个版本(网站必须响应)所以我担心如果我改变比例(将有5个比例)从站在彼此下面到彼此相邻,位置将搞砸。
此外,有什么方法可以告诉动画只有在CSS中将鼠标悬停在它上面时才会播放?或者我必须使用javascript / jquery吗?
CSS3:
#bluearrow{
animation: animationFrames ease 4s;
animation-iteration-count: 1;
transform-origin: 50% 100%;
animation-fill-mode:forwards; /*when the spec is finished*/
-webkit-animation: animationFrames ease 4s;
-webkit-animation-iteration-count: 1;
-webkit-transform-origin: 50% 100%;
-webkit-animation-fill-mode:forwards; /*Chrome 16+, Safari 4+*/
-moz-animation: animationFrames ease 4s;
-moz-animation-iteration-count: 1;
-moz-transform-origin: 50% 100%;
-moz-animation-fill-mode:forwards; /*FF 5+*/
-o-animation: animationFrames ease 4s;
-o-animation-iteration-count: 1;
-o-transform-origin: 50% 100%;
-o-animation-fill-mode:forwards; /*Not implemented yet*/
-ms-animation: animationFrames ease 4s;
-ms-animation-iteration-count: 1;
-ms-transform-origin: 50% 100%;
-ms-animation-fill-mode:forwards; /*IE 10+*/
}
@keyframes animationFrames{
0% {
left:0px;
top:0px;
opacity:1;
transform: rotate(0deg) scaleX(1) scaleY(1) ;
}
100% {
left:0px;
top:0px;
opacity:1;
transform: rotate(270deg) scaleX(1) scaleY(1) ;
}
}
@-moz-keyframes animationFrames{
0% {
left:0px;
top:0px;
opacity:1;
-moz-transform: rotate(0deg) scaleX(1) scaleY(1) ;
}
100% {
left:0px;
top:0px;
opacity:1;
-moz-transform: rotate(270deg) scaleX(1) scaleY(1) ;
}
}
@-webkit-keyframes animationFrames {
0% {
left:0px;
top:0px;
opacity:1;
-webkit-transform: rotate(0deg) scaleX(1) scaleY(1) ;
}
100% {
left:0px;
top:0px;
opacity:1;
-webkit-transform: rotate(270deg) scaleX(1) scaleY(1) ;
}
}
@-o-keyframes animationFrames {
0% {
left:0px;
top:0px;
opacity:1;
-o-transform: rotate(0deg) scaleX(1) scaleY(1) ;
}
100% {
left:0px;
top:0px;
opacity:1;
-o-transform: rotate(270deg) scaleX(1) scaleY(1) ;
}
}
@-ms-keyframes animationFrames {
0% {
left:0px;
top:0px;
opacity:1;
-ms-transform: rotate(0deg) scaleX(1) scaleY(1) ;
}
100% {
left:0px;
top:0px;
opacity:1;
-ms-transform: rotate(270deg) scaleX(1) scaleY(1) ;
}
}
#bluescale{
position: absolute;
}
HTML:
<section id="Skills">
<h3>Html/css</h3>
<img alt="blue scale" id="scale_blue" src="images/bluescale.svg">
<img alt="blue scale" id="bluearrow" src="images/bluearrow.svg">
<h3>Jquery</h3>
<img alt="pink scale" id="scale_pink" src="">
<h3>Javascript</h3>
<img alt="purple scale" id="scale_purple" src="">
<h3>Photoshop</h3>
<img alt="green scale" id="scale_green" src="">
<h3>Illustrator</h3>
<img alt="orange scale" id="scale_orange" src="">
</section><!--/skills-->
以下是我的其余代码:
我有两个css文件。不知道怎么上传两个小提琴。第二个css文件发布在我的问题中。基本上只是为了我的动画
答案 0 :(得分:1)
添加以下CSS:
#skills{ position: relative; }
和
#scale_blue{ position: absolute; top: 10px; left: 10px; }
#bluearrow{ position: absolute; top: 10px; left: 10px; }
然后,调整Top&amp;留下两个元素以满足您的需求。