- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有这个问题,我试图根据时间移动 CSS 图像,但不能使用它,因为它在 CSS 中。特征不是太阳,而是在这个 pen 中可以看到的黄色半圆动画。 .我正在尝试将那个半圆应用到一个完全随机的形状。
例如,如果形状是完全随机的并且在白色 Canvas 上并且中间有一个随机变形的圆圈,那么如何使用与此 pen 中看到的相同的动画填充该圆圈以及如何将该 CSS 转换为 javascript 或如何控制 CSS,因为它必须在设置某些值时停止和移动。
我不希望有人做所有事情,而是当我需要使用那支笔中看到的黄色功能时,我可能会协助我应该从哪里开始。
谢谢。
事情是这样的。
<div class="sunmoon">
<h2>Sun & Moon</h2>
<div class="sun-times">
<div class="sun-path">
<div class="sun-animation"></div>
</div>
<div class="sun-symbol-path"><span class="symbol">☀</span></div>
</div>
<div class="legend">
<div class="sunrise">05:30 AM</div>
<div class="sunset">8:04 PM</div>
</div>
<div class="clear"> </div>
</div>
<div class="controls">
<button class="start">Start</button>
<button class="reset">Reset</button>
</div>
@import "compass/css3";
$arc-diameter: 170px;
.sunmoon {
position: relative;
& > div {
margin-left: 10px
}
}
.sun-times {
margin-top: 40px;
width: 230px;
height: 60px;
border-bottom: 1px solid #999;
overflow-y: hidden;
.sun-path {
margin-left: 25px;
width: $arc-diameter;
height: $arc-diameter;
overflow: hidden;
border: 1px dashed #999;
border-radius: 50%;
}
.sun-symbol-path {
position: absolute;
color: yellow;
text-shadow: 0 0 5px black;
height: $arc-diameter / 2;
-webkit-transition: -webkit-transform 2s linear;
-webkit-transform-origin: 50% 100%;
-webkit-transform: rotateZ(-75deg);
left: ($arc-diameter / 2) + 25px;
bottom: 0;
.symbol {
position: relative;
font-size: 16px;
top: -8px;
}
}
.sun-animation {
width: 0px;
height: 150px;
background-color: rgba(255, 255, 0, 0.4);
-webkit-transition: width 2s linear;
transition: width 2s linear;
}
}
.legend {
position: absolute;
bottom: 1em;
& > div {
position: absolute;
font-size: 12px;
width: 80px;
}
.sunrise {
left: 15px;
}
.sunset {
left: 185px;
}
}
body {
background-image: url(foo);
background-color: #ccc;
font-family: Helvetica, Sans serif;
h2 {
font-size: 20px;
}
}
.controls {
margin-top: 50px;
}
$('.start').click(function () {
$('.sunmoon .sun-animation').css('width', '70%');
$('.sun-symbol-path').css('-webkit-transform', 'rotateZ(27deg)');
// TODO: mention that this isn't nice
// city.find('.sunmoon .sun-animation').css('-webkit-transform', 'scaleX(50)');
return false;
});
$('.reset').click(function () {
$('.sun-animation').css('width', '0%');
$('.sun-symbol-path').css('-webkit-transform', 'rotateZ(-75deg)');
return false;
});
最佳答案
您可以在 Illustrator 中创建一个形状,内部透明,外部颜色为您想要的颜色,然后设置另一个框(使用新颜色,在本例中为黄色,形状宽度相同),在该形状下方(例如使用 z-index
)和 position:absolute
和 left:-100%
,以及 onClick,开始和停止过渡向右。
我会推荐你使用 GSAP TimeLineMax .它允许您使用其功能播放和停止过渡,例如:
//off course after document load.
let animation = new TimelineMax();
animation
.to(
".underneath-box", //box class
10, //seconds
{
left:"100%", //100% of the width
ease: Power4.easeInOut //ease effect.
});
animation.pause(); //To prevent start.
$('start-button').click(function(){ //on start button click
animation.play().timeScale(1); //start animation
});
$('reset-button').click(function(){ //on reset button click
animation.reverse().timeScale(2); //reverse the entire animation
});
我假设您了解一些 Html 和 css 基础知识。不要忘记用它的类创建那些 div 和按钮。干杯。
关于javascript - 如何将这种无法识别的 CSS 特性转换为 javascript?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57811716/
目录 C#特性 1. 概括 2. 语法 定义特性类 应用特性
是否有关于 Python 语言必须提供哪些功能的文章/论文?为什么应该使用 Python 而不是任何其他语言? Python 的优点和缺点是什么? 最佳答案 Why Python和 Why Pytho
我想弄清楚为什么 .x比*.x具有更高的特异性当后者有望获胜时。 不是*.x应该具有 0-0-1-1 的特异性(1 个类,1 个标签)而 .x只是一个类(class) 0-0-1-0 ? 考虑以下基本
在尝试评估非 instanceof 条件时,我发现了我在 Groovy 2.4.7、1.6.0 JVM 中没有预料到的行为。 总之: class Foo { static Boolean
当使用可变结构和属性时,编译器可以解决一些问题,但不能对其他相当明显的事情做同样的事情,这对我来说似乎很奇怪。 以下面的自动属性为例: Vector2 Vector { get; set; } 而不是
我对 ES3 有一定的了解,但我对 ES5 的特性不是很了解。我 - 或多或少 - 知道: Object.create(), Object.freeze() “使用严格” getter 和 sette
我最近开始将 Django 1.5.4 用于带有 MySQL 后端的 Web 应用程序。就在一开始,我遇到了某些限制,这让我想知道 Django 是否是继续前进的正确方法。 一些明显的缺点是: 缺少复
在函数模板的定义中,模板参数的实例化一般是未知的。类型特征可用于在编译时获取一些信息。例如,这是 is_pointer 的一个简单应用: template void foo(T p) { cout
我正在设计页面的样式,该页面具有除最后一个框外的带底部边框的连续框。我为所有框应用类 .box 并添加 .box_last 以仅隐藏最后一个框的边框。 .box { border-bottom-s
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我有兴趣编制一份不建议在嵌入式系统中使用的 c++ 功能列表(这可能会导致人们推荐使用 c 而不是 c++)。如果您知道,请尝试添加原因,或者将您的原因添加到其他人的答案中。 这是一个开始(我知道的唯
作为一名 Ruby 程序员,您是否曾觉得任何使用起来有点冒险的功能,可能是因为它的奇怪行为?它可能有很好的文档记录,但在调试时很难找到,或者难以记住? 我通常尽量远离 String#gsub!。文档说
我正在开发一个连接到健身 watch 的蓝牙应用程序。这是我第一次使用蓝牙。我设法使用出色的 FlutterBlue 将我的应用程序与设备连接起来图书馆。 但是我无法理解我从阅读中获得的结果。这是我阅
1. 迭代器(Iterator)的介绍 背景:指针可以用来遍历存储空间连续的数据结构,但是对于存储空间费连续的,就需要寻找一个行为类似指针的类,来对非数组的数据结构进行遍历。 定义:迭代器是一种检
嗨,伙计们,有没有动态更改 Spring 属性文件内容的好例子?如果您能给我一些示例或链接,我将不胜感激。 非常感谢 最佳答案 我想你可以使用 ReloadableResourceBundleMess
SystemVerilog 引入了一些非常有用的结构来改进编码风格。然而,正如我的一位同事经常说的,“你不是在写软件,你是在描述硬件。”考虑到这一点,当最终结果需要合成时,应该避免语言的哪些特征?这个
我定义了这些测试依赖项 / Test Dependencies lazy val wiremock = "com.github.tomakehurst" % "wir
我正在为 Android 手机和 Android watch (wearOS) 编写应用程序。这些应用程序将通过蓝牙相互通信。基本上,Android 手机上的应用程序将与 WearOS 设备绑定(bi
我正在为 Android 手机和 Android watch (wearOS) 编写应用程序。这些应用程序将通过蓝牙相互通信。基本上,Android 手机上的应用程序将与 WearOS 设备绑定(bi
我有兴趣提高我的设计能力(设计具有属性、方法等的类)。即如何决定类、方法和属性应该是什么? 你们能建议我改进这个的好 Material 吗? 最佳答案 请看: Any source of good o
我是一名优秀的程序员,十分优秀!