css - 如何使具有 Ken Burns 效果的图像保持更大尺寸?
问题描述
我在图像上使用 Ken Burns 效果。它运行得很好,图像放大到 1.2 比例。但动画后图像将恢复到 1.0 比例。如何让它保持在 1.2 规模?
我在我的 Ken Burns 的工作原理下方发送了一个代码。
谢谢你。
.logopartner {
position: absolute;
top: 25%;
left: 25%;
animation: move 80s ease;
/* Add infinite to loop. */
-ms-animation: move 20s ease;
-webkit-animation: move 20s ease;
-0-animation: move 20s ease;
-moz-animation: move 20s ease;
position: absolute;
}
@-webkit-keyframes move {
0% {
-webkit-transform-origin: bottom left;
-moz-transform-origin: bottom left;
-ms-transform-origin: bottom left;
-o-transform-origin: bottom left;
transform-origin: bottom left;
transform: scale(1.0);
-ms-transform: scale(1.0);
/* IE 9 */
-webkit-transform: scale(1.0);
/* Safari and Chrome */
-o-transform: scale(1.0);
/* Opera */
-moz-transform: scale(1.0);
/* Firefox */
}
100% {
transform: scale(1.2);
-ms-transform: scale(1.2);
/* IE 9 */
-webkit-transform: scale(1.2);
/* Safari and Chrome */
-o-transform: scale(1.2);
/* Opera */
-moz-transform: scale(1.2);
/* Firefox */
}
}
<img class="logopartner" src="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon@2.png?v=73d79a89bded">
解决方案
您可以将比例默认设置为 1.2,因此其最终目标是其默认比例。
.logopartner {
position: absolute;
top: 25%;
left: 25%;
animation: move 80s ease;
transform: scale(1.2);
/* Add infinite to loop. */
-ms-animation: move 20s ease;
-webkit-animation: move 20s ease;
-0-animation: move 20s ease;
-moz-animation: move 20s ease;
position: absolute;
}
@-webkit-keyframes move {
0% {
-webkit-transform-origin: bottom left;
-moz-transform-origin: bottom left;
-ms-transform-origin: bottom left;
-o-transform-origin: bottom left;
transform-origin: bottom left;
transform: scale(1.0);
-ms-transform: scale(1.0);
/* IE 9 */
-webkit-transform: scale(1.0);
/* Safari and Chrome */
-o-transform: scale(1.0);
/* Opera */
-moz-transform: scale(1.0);
/* Firefox */
}
100% {
transform: scale(1.2);
-ms-transform: scale(1.2);
/* IE 9 */
-webkit-transform: scale(1.2);
/* Safari and Chrome */
-o-transform: scale(1.2);
/* Opera */
-moz-transform: scale(1.2);
/* Firefox */
}
}
<img class="logopartner" src="https://cdn.sstatic.net/Sites/stackoverflow/img/apple-touch-icon@2.png?v=73d79a89bded">
推荐阅读
- jmeter - 无法从 Jmeter 中的 2 个 CSF 文件中获取数据
- powershell - 通过 Powershell 通过 Azure Key Vault 管理的密钥访问 Azure 存储
- java - Java 在 HashMap 中存储连接
- angular - 如果没有 redux devtools 扩展,带有 NgRx 的 Angular 应用程序无法正常工作
- macos - 在一个文件夹中创建多个空的 .txt 文件
- c++ - 如何在 C++ 中调用命令行工具
- reactjs - 如何从打字稿中的反应钩子组件发出偶数?
- flutter - ffmpeg 似乎输出带有错误编解码器的视频?
- javascript - 在 if/else (Javascript) 中重新分配变量
- jenkins - 詹金斯:如何为参数化工作设置时间表?