问题描述
我一直在这个CSS3动画玩弄,但我不能让它从一个不同的位置比中间转动。
有导致从中间倒装样作用的动画,其中上半部进入负z轴与底部半进入正z轴
我想获得枢轴点是顶部,以便为这个动画应用到变换的元素,整个元素进入正z轴。
和则FLIPOUT的动画也只是那相反。
我想AP preciate在得到这个动画作为我描述的行为的任何帮助。
下面是,现在运行动画code:
.animated {
-webkit-动画填充模式:两者;
-moz-动画填充模式:两者;
-ms动画填充模式:两者;
-o-动画填充模式:两者;
动画填充模式:两者;
-webkit-动画持续时间:0.6秒;
-moz-动画持续时间:0.6秒;
-ms动画持续时间:0.6秒;
-o-动画持续时间:0.6秒;
动画持续时间:0.6秒;
}@ -webkit-关键帧flipInX {
0%{
-webkit-变换:观点(400像素)rotateX(90度);
不透明度:0;
} 40%{
-webkit-变换:观点(400像素)rotateX(-10deg);
} 70%{
-webkit-变换:观点(400像素)rotateX(10度);
} 100%{
-webkit-变换:观点(400像素)rotateX(0deg);
不透明度:1;
}
}
@ -moz-关键帧flipInX {
0%{
-moz-变换:观点(400像素)rotateX(90度);
不透明度:0;
} 40%{
-moz-变换:观点(400像素)rotateX(-10deg);
} 70%{
-moz-变换:观点(400像素)rotateX(10度);
} 100%{
-moz-变换:观点(400像素)rotateX(0deg);
不透明度:1;
}
}
@ -o-关键帧flipInX {
0%{
-o变换:观点(400像素)rotateX(90度);
不透明度:0;
} 40%{
-o变换:观点(400像素)rotateX(-10deg);
} 70%{
-o变换:观点(400像素)rotateX(10度);
} 100%{
-o变换:观点(400像素)rotateX(0deg);
不透明度:1;
}
}
@keyframes flipInX {
0%{
变换:视角(400像素)rotateX(90度);
不透明度:0;
} 40%{
变换:视角(400像素)rotateX(-10deg);
} 70%{
变换:视角(400像素)rotateX(10度);
} 100%{
变换:视角(400像素)rotateX(0deg);
不透明度:1;
}
}.flipInX {
-webkit-背面能见度:可见重要的;
-webkit-动画名称:flipInX;
-moz-背面能见度:可见重要的;
-moz-动画名称:flipInX;
-o-背面能见度:可见重要的;
-o-动画名称:flipInX;
背面能见度:可见重要的;
动画名称:flipInX;
}
@ -webkit-关键帧flipOutX {
0%{
-webkit-变换:观点(400像素)rotateX(0deg);
不透明度:1;
}
100%{
-webkit-变换:观点(400像素)rotateX(90度);
不透明度:0;
}
}@ -moz-关键帧flipOutX {
0%{
-moz-变换:观点(400像素)rotateX(0deg);
不透明度:1;
}
100%{
-moz-变换:观点(400像素)rotateX(90度);
不透明度:0;
}
}@ -o-关键帧flipOutX {
0%{
-o变换:观点(400像素)rotateX(0deg);
不透明度:1;
}
100%{
-o变换:观点(400像素)rotateX(90度);
不透明度:0;
}
}@keyframes flipOutX {
0%{
变换:视角(400像素)rotateX(0deg);
不透明度:1;
}
100%{
变换:视角(400像素)rotateX(90度);
不透明度:0;
}
}.flipOutX {
-webkit-动画名称:flipOutX;
-webkit-背面能见度:可见重要的;
-moz-动画名称:flipOutX;
-moz-背面能见度:可见重要的;
-o-动画名称:flipOutX;
-o-背面能见度:可见重要的;
动画名称:flipOutX;
背面能见度:可见重要的;
}
设置的:
变换产地:中心顶部;
每MDN文档:
变换原点:X偏移/ *一值的语法* /例如变换产地:2px的
变换产地:偏移例如关键字变换产地:底部变换原点:X-偏移Y偏移/ *两值语法* /例如变换产地:2px的3厘米
变换产地:Y-偏移x偏移,例如关键字变换产地:2px的左
变换原点:X-偏移关键字例如Y轴偏移量变换产地:2px的左
变换原点:X-失调关键字Y轴偏移量,例如关键字变换产地:右上
变换产地:Y-偏移关键字的x偏移例如关键字变换产地:右上变换原点:X-偏移Y偏移Z-偏移/ *三值语法* /例如变换产地:2px的30%10px的
变换产地:Y-偏移x偏移-关键字Z-例如偏移变换产地:2px的左10px的
变换原点:X-失调关键字Y轴偏移量例如Z-偏移变换产地:左为5px -3px
变换原点:X-偏移关键字的y偏移关键字Z-例如偏移变换产地:右下2厘米
变换产地:Y-偏移关键字的x偏移关键字Z-例如偏移变换产地:右下2厘米
I've been playing around with this CSS3 Animation, but I can't get it to pivot from a different location than the middle.
It is an animation that causes a flip-like effect from the middle where the top-half goes into the negative z-axis and the bottom-half goes into the positive z-axis.
I am trying to get the pivot-point to be the top so as the element that this animation is applied to is transformed, the entire element goes into the positive z-axis.
And then the flipOut animation would just be the reverse of that.
I'd appreciate any help in getting this animation to behave as I described.
Here is the code that runs the animation right now:
.animated {
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
-ms-animation-fill-mode: both;
-o-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-duration: 0.6s;
-moz-animation-duration: 0.6s;
-ms-animation-duration: 0.6s;
-o-animation-duration: 0.6s;
animation-duration: 0.6s;
}
@-webkit-keyframes flipInX {
0% {
-webkit-transform: perspective(400px) rotateX(90deg);
opacity: 0;
}
40% {
-webkit-transform: perspective(400px) rotateX(-10deg);
}
70% {
-webkit-transform: perspective(400px) rotateX(10deg);
}
100% {
-webkit-transform: perspective(400px) rotateX(0deg);
opacity: 1;
}
}
@-moz-keyframes flipInX {
0% {
-moz-transform: perspective(400px) rotateX(90deg);
opacity: 0;
}
40% {
-moz-transform: perspective(400px) rotateX(-10deg);
}
70% {
-moz-transform: perspective(400px) rotateX(10deg);
}
100% {
-moz-transform: perspective(400px) rotateX(0deg);
opacity: 1;
}
}
@-o-keyframes flipInX {
0% {
-o-transform: perspective(400px) rotateX(90deg);
opacity: 0;
}
40% {
-o-transform: perspective(400px) rotateX(-10deg);
}
70% {
-o-transform: perspective(400px) rotateX(10deg);
}
100% {
-o-transform: perspective(400px) rotateX(0deg);
opacity: 1;
}
}
@keyframes flipInX {
0% {
transform: perspective(400px) rotateX(90deg);
opacity: 0;
}
40% {
transform: perspective(400px) rotateX(-10deg);
}
70% {
transform: perspective(400px) rotateX(10deg);
}
100% {
transform: perspective(400px) rotateX(0deg);
opacity: 1;
}
}
.flipInX {
-webkit-backface-visibility: visible !important;
-webkit-animation-name: flipInX;
-moz-backface-visibility: visible !important;
-moz-animation-name: flipInX;
-o-backface-visibility: visible !important;
-o-animation-name: flipInX;
backface-visibility: visible !important;
animation-name: flipInX;
}
@-webkit-keyframes flipOutX {
0% {
-webkit-transform: perspective(400px) rotateX(0deg);
opacity: 1;
}
100% {
-webkit-transform: perspective(400px) rotateX(90deg);
opacity: 0;
}
}
@-moz-keyframes flipOutX {
0% {
-moz-transform: perspective(400px) rotateX(0deg);
opacity: 1;
}
100% {
-moz-transform: perspective(400px) rotateX(90deg);
opacity: 0;
}
}
@-o-keyframes flipOutX {
0% {
-o-transform: perspective(400px) rotateX(0deg);
opacity: 1;
}
100% {
-o-transform: perspective(400px) rotateX(90deg);
opacity: 0;
}
}
@keyframes flipOutX {
0% {
transform: perspective(400px) rotateX(0deg);
opacity: 1;
}
100% {
transform: perspective(400px) rotateX(90deg);
opacity: 0;
}
}
.flipOutX {
-webkit-animation-name: flipOutX;
-webkit-backface-visibility: visible !important;
-moz-animation-name: flipOutX;
-moz-backface-visibility: visible !important;
-o-animation-name: flipOutX;
-o-backface-visibility: visible !important;
animation-name: flipOutX;
backface-visibility: visible !important;
}
Set the transform origin:
transform-origin : center top;
Per MDN docs:
transform-origin: x-offset /* One-value syntax */ E.g. transform-origin: 2px
transform-origin: offset-keyword E.g. transform-origin: bottom
transform-origin: x-offset y-offset /* Two-value syntax */ E.g. transform-origin: 3cm 2px
transform-origin: y-offset x-offset-keyword E.g. transform-origin: 2px left
transform-origin: x-offset-keyword y-offset E.g. transform-origin: left 2px
transform-origin: x-offset-keyword y-offset-keyword E.g. transform-origin: right top
transform-origin: y-offset-keyword x-offset-keyword E.g. transform-origin: top right
transform-origin: x-offset y-offset z-offset /* Three-value syntax */ E.g. transform-origin: 2px 30% 10px
transform-origin: y-offset x-offset-keyword z-offset E.g. transform-origin: 2px left 10px
transform-origin: x-offset-keyword y-offset z-offset E.g. transform-origin: left 5px -3px
transform-origin: x-offset-keyword y-offset-keyword z-offset E.g. transform-origin: right bottom 2cm
transform-origin: y-offset-keyword x-offset-keyword z-offset E.g. transform-origin: bottom right 2cm
这篇关于我怎样才能改变这种翻转动画的“支点”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!