热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

css旋转动画定义中心,旋转时它的旋转中心位置如何CSS动画

0我修改了动画,并增加了transform-origin的微调:d.spinner-animation{width:500px;height:500px

0

我修改了动画,并增加了transform-origin的微调:d

.spinner-animation{

width: 500px;

height: 500px;

position: relative;

background: gray;

}

.spinner-animation > .spinner{

width: 400px;

height: 400px;

position: absolute;

left: 50%;

top: 50%;

transform-origin: top left;

transform: translate(-50%,-50%);

border-radius: 50%;

box-shadow: inset 3px 3px 3px red;

animation: spinner 1.2s linear infinite;

}

.spinner-animation > .content{

display: inline-block;

width: 300px;

height: 300px;

border-radius: 50%;

position: absolute;

left: 50%;

top: 50%;

transform: translate(-50%,-50%);

background-color: black;

text-align: center;

line-height: 300px;

color: white;

}

@keyframes spinner {

0% {

transform: rotate(0deg) translate(-50%,-50%);

}

100% {

transform: rotate(360deg) translate(-50%,-50%);

}

}

Loading...

2017-05-07 02:09:29

0

Flex的框溶液:显示作为flex元素的父元素,并对齐(垂直方向)和证明(水平地)其绝对定位的儿童到中心。

.spinner-animation{

width: 500px;

height: 500px;

background: gray;

display: flex;

align-items: center;

justify-content: center;

}

.spinner-animation > .spinner{

width: 400px;

height: 400px;

position: absolute;

border-radius: 50%;

box-shadow: inset 3px 3px 3px red;

animation: spinner 1.2s linear infinite;

}

.spinner-animation > .content{

display: inline-block;

width: 300px;

height: 300px;

border-radius: 50%;

position: absolute;

background-color: black;

text-align: center;

line-height: 300px;

color: white;

}

@keyframes spinner {

0% {

transform: rotate(0deg);

}

100% {

transform: rotate(360deg);

}

}

Loading...

2017-05-07 02:02:49

0

把span在另一个容器和应用position: absolute到这个容器

.spinner-animation {

width: 500px;

height: 500px;

position: relative;

background: gray;

}

.holder {

position: absolute;

width: 400px;

height: 400px;

left: 50%;

top: 50%;

transform: translate(-50%, -50%);

}

.holder .spinner {

display: block;

width: 100%;

height: 100%;

border-radius: 50%;

box-shadow: inset 3px 3px 3px red;

animation: spinner 1.2s linear infinite;

}

.spinner-animation>.content {

display: inline-block;

width: 300px;

height: 300px;

border-radius: 50%;

position: absolute;

left: 50%;

top: 50%;

transform: translate(-50%, -50%);

background-color: black;

text-align: center;

line-height: 300px;

color: white;

}

@keyframes spinner {

0% {

transform: rotate(0deg);

}

100% {

transform: rotate(360deg);

}

}

Loading...

2017-05-07 02:03:08

0

在动画中的transform被覆盖translate()定位,您需要将translate()添加到您的动画transform属性中。

.spinner-animation{

width: 500px;

height: 500px;

position: relative;

background: gray;

}

.spinner-animation > .spinner{

width: 400px;

height: 400px;

position: absolute;

left: 50%;

top: 50%;

transform: translate(-50%,-50%);

border-radius: 50%;

box-shadow: inset 3px 3px 3px red;

animation: spinner 1.2s linear infinite;

}

.spinner-animation > .content{

display: inline-block;

width: 300px;

height: 300px;

border-radius: 50%;

position: absolute;

left: 50%;

top: 50%;

transform: translate(-50%,-50%);

background-color: black;

text-align: center;

line-height: 300px;

color: white;

}

@keyframes spinner {

0% {

transform: translate(-50%,-50%) rotate(0deg);

}

100% {

transform: translate(-50%,-50%) rotate(360deg);

}

}

Loading...

2017-05-07 02:08:37



推荐阅读
  • 在Android开发中,使用Picasso库可以实现对网络图片的等比例缩放。本文介绍了使用Picasso库进行图片缩放的方法,并提供了具体的代码实现。通过获取图片的宽高,计算目标宽度和高度,并创建新图实现等比例缩放。 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文介绍了Web学习历程记录中关于Tomcat的基本概念和配置。首先解释了Web静态Web资源和动态Web资源的概念,以及C/S架构和B/S架构的区别。然后介绍了常见的Web服务器,包括Weblogic、WebSphere和Tomcat。接着详细讲解了Tomcat的虚拟主机、web应用和虚拟路径映射的概念和配置过程。最后简要介绍了http协议的作用。本文内容详实,适合初学者了解Tomcat的基础知识。 ... [详细]
  • 本文整理了常用的CSS属性及用法,包括背景属性、边框属性、尺寸属性、可伸缩框属性、字体属性和文本属性等,方便开发者查阅和使用。 ... [详细]
  • 云原生边缘计算之KubeEdge简介及功能特点
    本文介绍了云原生边缘计算中的KubeEdge系统,该系统是一个开源系统,用于将容器化应用程序编排功能扩展到Edge的主机。它基于Kubernetes构建,并为网络应用程序提供基础架构支持。同时,KubeEdge具有离线模式、基于Kubernetes的节点、群集、应用程序和设备管理、资源优化等特点。此外,KubeEdge还支持跨平台工作,在私有、公共和混合云中都可以运行。同时,KubeEdge还提供数据管理和数据分析管道引擎的支持。最后,本文还介绍了KubeEdge系统生成证书的方法。 ... [详细]
  • 阿,里,云,物,联网,net,core,客户端,czgl,aliiotclient, ... [详细]
  • 1,关于死锁的理解死锁,我们可以简单的理解为是两个线程同时使用同一资源,两个线程又得不到相应的资源而造成永无相互等待的情况。 2,模拟死锁背景介绍:我们创建一个朋友 ... [详细]
  • 《数据结构》学习笔记3——串匹配算法性能评估
    本文主要讨论串匹配算法的性能评估,包括模式匹配、字符种类数量、算法复杂度等内容。通过借助C++中的头文件和库,可以实现对串的匹配操作。其中蛮力算法的复杂度为O(m*n),通过随机取出长度为m的子串作为模式P,在文本T中进行匹配,统计平均复杂度。对于成功和失败的匹配分别进行测试,分析其平均复杂度。详情请参考相关学习资源。 ... [详细]
  • 高质量SQL书写的30条建议
    本文提供了30条关于优化SQL的建议,包括避免使用select *,使用具体字段,以及使用limit 1等。这些建议是基于实际开发经验总结出来的,旨在帮助读者优化SQL查询。 ... [详细]
  • Go GUIlxn/walk 学习3.菜单栏和工具栏的具体实现
    本文介绍了使用Go语言的GUI库lxn/walk实现菜单栏和工具栏的具体方法,包括消息窗口的产生、文件放置动作响应和提示框的应用。部分代码来自上一篇博客和lxn/walk官方示例。文章提供了学习GUI开发的实际案例和代码示例。 ... [详细]
  • 合并列值-合并为一列问题需求:createtabletab(Aint,Bint,Cint)inserttabselect1,2,3unionallsel ... [详细]
  • 本文介绍了如何使用n3-charts绘制以日期为x轴的数据,并提供了相应的代码示例。通过设置x轴的类型为日期,可以实现对日期数据的正确显示和处理。同时,还介绍了如何设置y轴的类型和其他相关参数。通过本文的学习,读者可以掌握使用n3-charts绘制日期数据的方法。 ... [详细]
  • Python的参数解析argparse模块的学习
    本文介绍了Python中参数解析的重要模块argparse的学习内容。包括位置参数和可选参数的定义和使用方式,以及add_argument()函数的详细参数关键字解释。同时还介绍了命令行参数的操作和可接受数量的设置,其中包括整数类型的参数。通过学习本文内容,可以更好地理解和使用argparse模块进行参数解析。 ... [详细]
  • 本文讨论了在dva中引入antd组件table时没有显示样式的问题。提供了.roadhogrc文件的配置,包括环境和import的设置。同时介绍了extraBabelPlugins和transform-runtime的使用方法,并解释了libraryName和css的含义。 ... [详细]
author-avatar
yema狂想曲
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有