- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
哪种语言可以简化此代码,这样我就可以轻松添加更多叶子,而无需一遍又一遍地复制粘贴所有代码。我尝试了几个较少的编译器,但没有一个有效!我知道这可能非常简单,但我认为我只是需要另一个想法来重新思考,因为我被难住了!我想要将近 100 片树叶从旋转的 J 中射出,并希望每片树叶都有不同的路径和时间,就好像风是从 Logo 中吹来的一样!
body html{
overflow: none;
}
.logo{
width: 100vw;
}
.j{
display: block;
margin: 0 auto;
height: 100px;
width: auto;
animation: spin 6s linear infinite;
}
@keyframes spin{
0%{
transform: rotateY(2880deg);
}
80%{
transform: rotateY(360deg);
}
}
.fa{
transform: scale(.5);
}
@keyframes leafanimation {
0% {
transform:translate(0,0) rotate(1440deg);
}
10% {
transform:translate(0,0) rotate(1440deg);
}
40% {
transform:translate(0px,100px) rotate(1080deg); }
60% {
transform:translate(-250px,200px) rotate(720deg); }
80% {
transform:translate(-450px,450px) rotate(360deg); }
100% {
transform:translate(-900px,500px) rotate(0deg);
}
}
.my-logo {
position:absolute;
top:0;
left:50%;
height: 40px;
width: 200px;
line-height: 40px;
font-size: 36px;
color: red;
animation: leafanimation 6s linear infinite;
}
.my-logo div {
display: inline-block;
width: 20px;
height: 40px;
vertical-align: middle;
border-radius: 20px;
}
.my-logo1 {
position:absolute;
top:0;
left:50%;
height: 40px;
width: 50px;
line-height: 40px;
font-size: 36px;
color: green;
animation: leafanimation 6s linear infinite;
animation-delay: .5s;
}
.my-logo1 div {
display: inline-block;
width: 20px;
height: 40px;
vertical-align: middle;
border-radius: 20px;
}
.my-logo2 {
position:absolute;
top:0;
left:50%;
height: 40px;
width: 150px;
line-height: 40px;
font-size: 36px;
color: blue;
animation: leafanimation 6s linear infinite;
animation-delay: .7s;
}
.my-logo2 div {
display: inline-block;
width: 20px;
height: 40px;
vertical-align: middle;
border-radius: 20px;
}
.my-logo3 {
position:absolute;
top:0;
left:50%;
height: 40px;
width: 150px;
line-height: 40px;
font-size: 36px;
color: pink;
animation: leafanimation 6s linear infinite;
animation-delay: .2s;
}
.my-logo3 div {
display: inline-block;
width: 20px;
height: 40px;
vertical-align: middle;
border-radius: 20px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet"/>
<div class="logo"><img class="j" src="https://www.freeiconspng.com/uploads/letter-j-icon-png-24.png"</img></div>
<div class="my-logo">
<div><i class="fa fa-leaf" aria-hidden="true"></i></div>
</div>
<div class="my-logo1">
<div><i class="fa fa-leaf" aria-hidden="true"></i></div>
</div>
<div class="my-logo2">
<div><i class="fa fa-leaf" aria-hidden="true"></i></div>
</div>
<div class="my-logo3">
<div><i class="fa fa-leaf" aria-hidden="true"></i></div>
</div>
最佳答案
您的 CSS 类中有很多冗余,可以更好地封装。您可以简单地为具有公共(public)属性的叶子使用一个基类,并在不同的类或 ID 中添加颜色和延迟等信息(正如我在下面所做的那样)。
这样,通过为所有叶子创建一个公共(public)类,您可以省略重复的 .mylogo .div
。
我自由地将您的一些类重命名为 leaf
以提高我这边的可读性,请随时重命名。
这导致 CSS 更短:
body html {
overflow: none;
}
.logo {
width: 100vw;
}
.j {
display: block;
margin: 0 auto;
height: 100px;
width: auto;
animation: spin 6s linear infinite;
}
@keyframes spin {
0% {
transform: rotateY(2880deg);
}
80% {
transform: rotateY(360deg);
}
}
.fa {
transform: scale(.5);
}
@keyframes leafanimation {
0% {
transform: translate(0, 0) rotate(1440deg);
}
10% {
transform: translate(0, 0) rotate(1440deg);
}
40% {
transform: translate(0px, 100px) rotate(1080deg);
}
60% {
transform: translate(-250px, 200px) rotate(720deg);
}
80% {
transform: translate(-450px, 450px) rotate(360deg);
}
100% {
transform: translate(-900px, 500px) rotate(0deg);
}
}
.leaf {
position: absolute;
top: 0;
left: 50%;
height: 40px;
line-height: 40px;
font-size: 36px;
animation: leafanimation 6s linear infinite;
}
.leaf div {
display: inline-block;
width: 20px;
height: 40px;
vertical-align: middle;
border-radius: 20px;
}
#leaf-1 {
width: 200px;
color: red;
}
#leaf-2 {
width: 50px;
color: green;
animation-delay: .5s;
}
#leaf-3 {
width: 150px;
color: blue;
animation-delay: .7s;
}
#leaf-4 {
width: 150px;
color: pink;
animation-delay: .2s;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css" rel="stylesheet" />
<div class="logo"><img class="j" src="https://www.freeiconspng.com/uploads/letter-j-icon-png-24.png" </img></div>
<div class="leaf" id="leaf-1">
<div><i class="fa fa-leaf" aria-hidden="true"></i></div>
</div>
<div class="leaf" id="leaf-2">
<div><i class="fa fa-leaf" aria-hidden="true"></i></div>
</div>
<div class="leaf" id="leaf-3">
<div><i class="fa fa-leaf" aria-hidden="true"></i></div>
</div>
<div class="leaf" id="leaf-4">
<div><i class="fa fa-leaf" aria-hidden="true"></i></div>
</div>
关于html - 什么语言的 css 会减少我使用的代码量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51482815/
我是 Bison 解析的新手,我无法理解它是如何工作的。我有以下语法,其中我保留了最低限度的语法来突出问题。 %left '~' %left '+' %token T_VARIABLE %% star
我链接了 2 个映射器和 1 个缩减器。是否可以将中间输出(链中每个映射器的 o/p)写入 HDFS?我尝试为每个设置 OutputPath,但它似乎不起作用。现在,我不确定是否可以完成。有什么建议吗
我正在编写一些代码来管理自定义磁盘文件结构并将其同步到未连接的系统。我的要求之一是能够在实际生成同步内容之前估计同步的大小。作为一个简单的解决方案,我整理了一个包含完整路径文件名的 map ,作为高效
我来自一个 SQL 世界,其中查找由多个对象属性(published = TRUE 或 user_id = X)完成,并且有 任何地方都没有加入 (因为 1:1 缓存层)。文档数据库似乎很适合我的数据
在 R 中,我有一个整数向量。从这个向量中,我想随机减少每个整数元素的值,以获得向量的总和,即初始总和的百分比。 在这个例子中,我想将向量“x”减少到向量“y”,其中每个元素都被随机减少以获得等于初始
我发现自己遇到过几次我有一个 reducer /组合 fn 的情况,如下所示: def combiner(a: String, b: String): Either[String, String]
Ubuntu 12.04 nginx 1.2.4 avconv版本 avconv version 0.8.10-4:0.8.10-0ubuntu0.12.04.1, Copyright (c) 200
我是 R 编程语言的新手。我有一个包含 2 列(ID 和 Num)的数据集,如下所示: ID Num 3 8 3 12 4 15 4 18 4
我正在使用高阶函数将函数应用于向量中的每个元素并将结果作为标量值返回。 假设我有: v = c(0, 1, 2, 3, 4, 5, 6, 7, 8) 我想计算以左边 5 个整数为中心的所有这些整数的总
关闭。这个问题需要debugging details .它目前不接受答案。 编辑问题以包含 desired behavior, a specific problem or error, and th
这个问题在这里已经有了答案: How to write the dataframes in a list to a single csv file (2 个回答) 5年前关闭。 我正在尝试使用 Red
刚开始学习CUDA编程,对归约有些迷茫。 我知道与共享内存相比,全局内存有很多访问延迟,但我可以使用全局内存来(至少)模拟类似于共享内存的行为吗? 例如,我想对长度恰好为 BLOCK_SIZE * T
我经常使用OptiPNG或pngcrush减小PNG图像的文件大小。 我希望能够从.NET应用程序中以编程方式执行此类操作。我正在动态生成要发送到移动设备的PNG,因此我想减小文件大小。 图像质量很重
减少和减少让您在序列上累积状态。 序列中的每个元素都会修改累积的状态,直到 到达序列的末尾。 在无限列表上调用reduce 或reductions 有什么含义? (def c (cycle [0]))
这与R: use the newly generated data in the previous row有关 我意识到我面临的实际问题比我在上面的线程中给出的示例要复杂一些 - 似乎我必须将 3 个
有什么办法可以减少.ttf字体的大小?即如果我们要删除一些我们不使用的glyps。 最佳答案 使用Google Web Fonts,您可以限制字符集,例如: //fonts.googleapis.co
我需要在iOS中制作一个应用程序,在她的工作过程中发出类似“哔”的声音。 我已经使用MPMusicPlayerController实现了与背景ipod的交互。 问题: 由于来自ipod的音乐音量很大,
我有一个嵌套 map m,如下所示: m = Map("电子邮件"-> "a@b.com", "背景"-> Map("语言"-> "英语")) 我有一个数组arr = Array("backgroun
有什么原因为什么不应该转发map / reduce函数中收到的可写内容? 我的意思是-每个map / reduce函数都有一个可写的键/值,并可能发出一个键/值对。如果我想执行一些过滤,我应该只发出接
假设我有一个数据列表 val data = listOf("F 1", "D 2", "U 1", "D 3", "F 10") 我想执行每个元素的给定逻辑。 我必须在外部添加 var acc2 =
我是一名优秀的程序员,十分优秀!