- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试将一串文本添加到我的 Spinner 图形中。例如,我希望能够将文本放置在微调轮的下方、旁边 或内部。问题是,我不知道该怎么做。另外,我只想对文本本身进行半动画处理(如果我对它进行过多的动画处理,用户可能无法阅读)。
window.onload = function () {
function spinner(holderid, R1, R2, count, stroke_width, color) {
var sectorsCount = count || 12,
color = color || "#fff",
width = stroke_width || 15,
r1 = Math.min(R1, R2) || 35,
r2 = Math.max(R1, R2) || 60,
cx = r2 + width,
cy = r2 + width,
r = Raphael(holderid, r2 * 2 + width * 2, r2 * 2 + width * 2),
sectors = [],
opacity = [],
beta = 2 * Math.PI / sectorsCount,
pathParams = {
stroke: color,
"stroke-width": width,
"stroke-linecap": "round"
};
Raphael.getColor.reset();
for (var i = 0; i < sectorsCount; i++) {
var alpha = beta * i - Math.PI / 2,
cos = Math.cos(alpha),
sin = Math.sin(alpha);
opacity[i] = 1 / sectorsCount * i;
sectors[i] = r.path([
["M", cx + r1 * cos, cy + r1 * sin],
["L", cx + r2 * cos, cy + r2 * sin]
]).attr(pathParams);
if (color == "rainbow") {
sectors[i].attr("stroke", Raphael.getColor());
}
}
var tick;
(function ticker() {
opacity.unshift(opacity.pop());
for (var i = 0; i < sectorsCount; i++) {
sectors[i].attr("opacity", opacity[i]);
}
r.safari();
tick = setTimeout(ticker, 1000 / sectorsCount);
})();
return function () {
clearTimeout(tick);
r.remove();
};
}
spinner("holder", 0, 120, 17, 2, "#000");
// spinner("holder", -120, 120, 17, 2, "#005075"); Second spinner inserted above first spinner
};
<div>
<!-- .placeholder is where the main Loading graphic (or animation) appears -->
<div class="placeholder"></div>
<!-- .text is where the Loading text appears: -->
<!-- next to the graphic, vertically aligned to the middle -->
<div class="text">loading</div>
</div>
最佳答案
您在提供的演示中混合了 2 个库,微调器是 Raphael,加载文本是 jQuery。我在这里结合了两者 - http://jsfiddle.net/robschmuecker/vM9uk/13/ - 这是此 HTML 的组合:
<div class="box">
<!-- .placeholder is where the main Loading graphic (or animation) appears -->
<div class="placeholder"></div>
<!-- .text is where the Loading text appears: next to the graphic -->
<div class="text">loading <span class="dot">.</span>
<span class="dot">.</span>
<span class="dot">.</span>
</div>
</div>
这个 JavaScript 包含了 RaphaelJS 和 jQuery:
$(document).ready(function () {
var firstDot = $(".dot:first-of-type");
var midDot = $(".dot:nth-of-type(2)");
var lastDot = $(".dot:last-of-type");
firstDot.hide();
midDot.hide();
lastDot.hide();
$(".placeholder,.text").hide().fadeIn(1000, function () {
var interv = 0;
interv = setInterval(function () {
firstDot.fadeIn(250, function () {
midDot.fadeIn(250, function () {
lastDot.fadeIn(250);
});
}).delay(1000).fadeOut(250, function () {
midDot.fadeOut(250, function () {
lastDot.fadeOut(250);
});
});
}, 3000)
});
});
然后是一些简单的 CSS 来操纵加载文本和微调器的位置。然而,这可能并不理想,因为您必须同时加载 RaphaelJS 和 jQuery。在纯 RaphaelJS 中也完全有可能做到这一点;看看这里的引用:http://raphaeljs.com/reference.html和演示以了解您想要做什么。例如,这里我们在微调器的中间添加了一个简单的文本元素,并在连续循环中淡入淡出。 (演示:http://jsfiddle.net/robschmuecker/vM9uk/14/)
tempText = r.text(R2, R2, "Loading ...");
function fadeTextOut(){
tempText.animate({opacity: 0}, 2500, fadeTextIn);
}
function fadeTextIn(){
tempText.animate({opacity: 1}, 2500, fadeTextOut);
}
fadeTextOut();
关于javascript - 拉斐尔 : trying to add semi-animated text to Spinner graphic,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24603747/
我想使用 linux 终端在 .txt 文档中找到字符串 animal-0**。 ** 是从 60 到 69 的数字。我想我必须在命令中使用 grep 和正则表达式:grep -E 'animal-0
在他的C# 深入一书中,Jon Skeet 试图回答以下问题: Why can't I convert List to List? 为了解释它,他从一个代码片段开始,其中包括以下两行: Animal[
我对此有点困惑,所以希望能提供一些说明。 public void addAll(List animals) 对比 public void addAll(List animals) 最佳答案 区别在于
我遇到的情况是,我有许多CALayer以“基于回合”的方式进行动画处理。我为每个CALayer上的位置设置了动画,但是它们具有完全相同的持续时间。一旦所有这些CALayer动画完成,就会启动一个新的“
我为正在拔出的刀和空闲状态设置了动画,但是无论我做什么,它们都不会在游戏中设置动画。相反,它卡住在第一帧上。这是动画窗口运行时的样子: 动画: 在检查器中: 最佳答案 我遇到了类似的问题,它归结于动画
我的单个 HTML 文件中嵌入了 2 个页面。所以它所做的是最初它显示 PAGE1,然后如果我从右向左或从左向右滑动 PAGE2 应该显示。我的问题是如何根据我的滑动更改页面动画?比如当我从右向左滑动
我想做一个动画标题。 我创建了一个 FlatList 的动画组件, 用过 onScroll函数来更新动画值。 使用绝对位置放置一个 View (Animated.View) 作为动画 FlatList
我想制作一个打开的窗帘的动画。我有两张图像:一张用于窗帘的左侧,一张用于窗帘的右侧(以红色表示)。我想用核心动画顺利地将它们滑走。我应该寻找什么类型的动画?如何实现逼真的滑动风格? 问候, 斯特凡 a
我有一个简单的旋转动画,可以让一个对象绕其轴旋转。目前它旋转得太快了,我想减慢速度,我试过增加样本??但我对动画了解不多,所以我可能过得很好。如何放慢动画速度?它只有两个键。 最佳答案 首先,通过双击
我似乎无法在上类时获得 angularjs ng-animate,而且在野外似乎也没有任何示例。以演示 fiddle 为例: http://jsfiddle.net/yfajy/ 向 CSS 添加如下
使用以下代码段:http://jsfiddle.net/sylouuu/V7a3Y/2/ 我想在动画的#log 中显示从 0% 到 100% 的进度百分比,100% 很容易通过回调... 有可能这样做
我正在 HTML 中使用 SVG 来使用折线工具定义特定的形状。我希望通过按一下按钮并在几秒钟内将特定形状的外观动画化为不同的形状。 我一直在考虑使用动画工具来更改折线点属性,但到目前为止一直无法找到
您好,在 Firefox(相当糟糕)和 Chrome 之间获得可变性能和效果(还可以)有时这不会执行第一个动画,有时会卡住。 我的结构正确吗? $notification.animate({
我在 iOS 编程时遇到了一个问题:当我尝试为我的 tableView 制作自定义编辑按钮时,我无法将其设置为动画。下面是我如何初始化 tableview: - (void)viewWillAppea
自 beta 5 以来,我注意到在 OS X 10.10 下隐式动画有一些奇怪的行为。调用动画代理有时会导致应用程序崩溃。我设置了一个非常简单的自定义 View 。这是完整的代码: import Co
我正在开发一个可折叠组件,您可以单击它来向上/向下滚动以显示/隐藏详细信息。组件如下: // component.ts import {Component, Directive, Input} fro
我正在努力了解 web animations standard和他们的 polyfill ,正如我所见,它在 Angular 动画库中运行良好(您将动画结束值设置为“*”,这将变为 div 大小的 1
我想创建一个动画闪屏,但出现此错误: Android.Content.Res.Resources+NotFoundException: File res/drawable/splash_screen.
我正在尝试对我的应用程序应用慢动作效果,就像按 Shift 时如何减慢 Mac OS 的大多数图形效果一样。 我的应用程序使用 CoreAnimation,所以我认为它应该没什么大不了的:set sp
我想以编程方式同时不在XML文件中显示两个动画,它应该 ROTATE和TRANSLATE 我怎样才能做到这一点? 请以某种方式建议我?????? 这是ma代码:> ImageView snowImg1
我是一名优秀的程序员,十分优秀!