- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
我正在尝试了解 CSS transition-delay
属性的负值。请先看代码示例。有两个 div
具有不同的转换延迟。
我认为为延迟提供负值与为右 div
(0.2s
) 提供正值是一样的,但它们的行为并不相同。我认为它不会在 0.2s
内绘制,这会使过渡变得不稳定。
transition-delay
值的作用是什么? transition-delay
的负值是否有效,还是不应使用? function toggle() {
var left = document.querySelector('.left');
var right = document.querySelector('.right');
left.classList.toggle('hidden');
right.classList.toggle('hidden');
left.classList.toggle('show');
right.classList.toggle('show');
}
window.setInterval(toggle, 1500);
window.setTimeout(toggle, 100);
#container {
background: yellow;
display: flex;
width: 200px;
height: 200px;
overflow: hidden;
}
.left,
.right {
flex: 1;
}
.left {
background: red;
transition: transform 1s -0.2s cubic-bezier(0.19, 1, 0.22, 1);
}
.right {
background: blue;
transition: transform 1s cubic-bezier(0.19, 1, 0.22, 1);
}
.hidden {
transform: translateY(100%);
}
.show {
transform: translateY(0%);
}
.container-hide {
transform: translateY(-100%);
}
<div id="container">
<div class="left hidden"></div>
<div class="right hidden"></div>
</div>
最佳答案
负数transition-delay
实际上是完全有效的,它与 0s
有不同的含义并且与正延迟不同。
摘自 W3C Working Draft for transition-delay :
If the value for
transition-delay
is a negative time offset then the transition will execute the moment the property is changed, but will appear to have begun execution at the specified offset. That is, the transition will appear to begin part-way through its play cycle. In the case where a transition has implied starting values and a negativetransition-delay
, the starting values are taken from the moment the property is changed.
结果是动画的第一部分将被跳过。基本上,开始时间发生了变化,从而改变了动画上的计算点。
所以如果 10s
持续时间动画有一个 -5s
延迟,它会出现在中途开始(跳过前半部分),并且仅在 5s
内完成.这里有一个简单的例子来展示这个效果。
function toggle() {
var left = document.querySelector('.left');
var right = document.querySelector('.right');
left.classList.toggle('hidden');
right.classList.toggle('hidden');
left.classList.toggle('show');
right.classList.toggle('show');
}
window.setInterval(toggle, 15000);
window.setTimeout(toggle, 100);
#container {
background: yellow;
display: flex;
width: 200px;
height: 200px;
overflow: hidden;
}
.left,
.right {
flex: 1;
}
.left {
background: red;
transition: transform 10s linear;
transition-delay: -5s;
}
.right {
background: blue;
transition: transform 10s linear;
transition-delay: 0s;
}
.hidden {
transform: translateY(100%);
}
.show {
transform: translateY(0%);
}
.container-hide {
transform: translateY(-100%);
}
<div id="container">
<div class="left hidden"></div>
<div class="right hidden"></div>
</div>
没有任何理由必须避免使用负持续时间值,因为它们是有效的,它们的用例非常有限。
关于javascript - 具有负值的 CSS transition-delay?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41432527/
我有一个带有标志属性的枚举,我用它来表示权限。我用它来比较 if (CurrentPermissions & Permission1 == Permission1) 等... [FlagsAttrib
我在使用具有两个不同日期的 TIMEDIFF 时遇到问题。以下查询“应该”返回00:04:51 mysql> SELECT TIMEDIFF(TIME('2013-07-21 00:04:50'),T
我有一个页面抛出 JavaScript 异常: Unhandled exception at line 5144, column 13 in raphael.js0x80048270 - JavaSc
我有一个大整数,比如说 BigInteger a=Biginteger.valueOf(50); 除此之外 BigInteger a=(BigInteger.ZERO).subtract(BigInt
我正在使用 CoreLocation 框架获取我的速度和距离来计算平均速度。 在 CoreLocation 发出的第一个更新中,它显示了速度和行进距离的负值。我该如何解决这个问题? 速度是 locat
我有一个数据框“df”: x y 0 1 -1 1 -2 -3 2 3 4 3 4 5 4 9 6 我正在尝试确定 x 和 y 值的百分比是正数还是负数。所
引用自:http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html 'd' '\u0054' Formats the a
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: Negative ASCII value int main() { char b = 8-'3';
发现了一个令人费解的指标——事件消息计数为负值。我已确认 ServiceBus Explorer (v3.0.4) 和 Azure 门户报告相同的负值。 怎么会发生这种事? 我为 SB 队列启用了以下
我正在尝试编译一个很大程度上依赖于 libcurl 和 pcap 的自定义包,在我的机器上它工作得很好,但是当我尝试使用工具链编译它时,我收到此错误: $ /home/kavastudios/site
我正在开发一个桌面软件,它向用户每次执行主要操作收费。例如,每个 PDF 打印将向用户收取 0.1 美元的费用。 我的软件提供多线程。 . 所以,如果它运行单线程,它就可以正常工作:) 但问题是如果用
我有一个用户模型和一个工作场所模型。用户有一个字段性别(男/女),每个工作场所有很多用户。我想要选择工作场所的用户总数以及按工作场所名称分组的工作场所的女性用户总数。 这是我尝试过的。 User.se
我正在尝试在 D3 中创建一个复制 this design 的条形图.这个想法是值的范围可以从 -100 到 100 并且彼此并排显示。比例必须保持在 0-100,并使用颜色来指示数字是高于还是低于
我在使用 gcc4.4 的 Ubuntu 10.04 中遇到同样的问题,相同的代码有效使用 gcc4.1 在 RH 5.5 上很好 #include #include int main(int a
size_t 被声明为 unsigned int 所以它不能表示负值。 所以有 ssize_t 这是signed 类型的 size_t 对吗? 这是我的问题: #include #include
我正在尝试确定 x 列对于这些列中的值是否具有相同的方向(正或负)或者它们是否具有不同的方向(例如,一个为正,另一个为负)。 我目前正在使用 with确定列中的值是否为 > 0 , 0 & coun
我的 Firebird 过程采用了几个具有 bigint 值的参数。 当我从 uint64 类型的 go 程序参数调用此过程时,值大于 max int32/2 存储为负数。 如何将 bigint/ui
我正在考虑是否可以消除编译器警告。警告来自将 uint32 与 -1 进行比较。 现在只看一眼,这似乎是一件不明智的事情,因为 uint32 永远不应该为负,但我没有编写这段代码,也不熟悉 c++ 的
我有以下数据框(由负数和正数组成): df.head() Out[39]: Prices 0 -445.0 1 -2058.0 2 -954.0 3 -520.0 4 -73
我正在尝试使用库WPF Metro UI Charts,它派生自Modern UI Charts。但是,当我尝试在 Page 而不是 Window 中使用图表时,我遇到了 ClusteredColum
我是一名优秀的程序员,十分优秀!