- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我正在尝试在单击播放按钮时创建旋转 CD/磁盘效果。我设法想出了一个例子,请参见下面的代码。这是播放器处于播放模式时的部分状态。
我想要创建的是一个方形图像,顶部有一个播放按钮。当用户点击按钮时,暂停按钮出现,图像的中间部分开始像旋转的 CD/磁盘一样旋转。
我尝试了一些方法,但我的 JavaScript 技能不足以创建这样的效果。
感谢任何帮助。
注意:代码答案应该能够在 Jimdo 上运行网站 build 者。
$(function() {
var activePlayerStartBtn;
function stopOtherPlayerSetNewAsActive(element) {
var toShow = $(element).parent().find('.btn.hide')[0];
$(element).addClass('hide');
$(toShow).removeClass('hide');
if (activePlayerStartBtn) {
var stopButton = $(activePlayerStartBtn).parent().find('.btn').not('.hide')[0];
$(stopButton).addClass('hide');
$(activePlayerStartBtn).removeClass('hide');
}
activePlayerStartBtn = element;
}
function stopPlayer(element) {
$(element).addClass('hide');
$(activePlayerStartBtn).removeClass('hide');
activePlayerStartBtn = null;
}
var widget1 = SC.Widget("so");
$("#playSound").click(function() {
widget1.play();
stopOtherPlayerSetNewAsActive("#playSound");
});
$("#stopSound").click(function() {
widget1.pause();
stopPlayer('#stopSound');
});
});
.button-wrapper {
position: relative;
width: 100%;
max-width: 300px;
}
.img-circle {
clip-path: circle(30% at 50% 50%);
-webkit-clip-path: circle(30% at 50% 50%);
animation: loading 10s linear infinite;
width: 100%;
max-width: 300px;
}
@keyframes loading {
0% {
transform: rotate(0);
}
100% {
transform: rotate(360deg);
}
}
.btn {
position: absolute;
width: 100%;
max-width: 70px;
cursor: pointer;
transform: translate(-50%, -53%);
top: 50%;
left: 50%;
opacity: .7;
clip-path: circle(33% at 50% 50%);
-webkit-clip-path: circle(33% at 50% 50%);
}
.hide {
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">
</script>
<script type="text/javascript" src="https://u.jimcdn.com/cms/o/s64e01451c5929131/userlayout/js/api.js">
</script>
<div class="button-wrapper">
<img src="https://i1.sndcdn.com/artworks-000281899403-n7tdjo-t500x500.jpg" alt="img" class="img-circle">
<img id="playSound" src="https://u.jimcdn.com/cms/o/s64e01451c5929131/userlayout/font/sc-playbtn.svg" alt="play" title="play" class="btn" name="playSound">
<img id="stopSound" src="https://u.jimcdn.com/cms/o/s64e01451c5929131/userlayout/font/sc-pausebtn.svg" alt="pause" title="pause" class="btn hide" name="stopSound">
</div>
<iframe id="so" width="0%" height="0" scrolling="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/380167502&color=%23ff5500&auto_play=false&hide_related=true&show_comments=false&show_user=false&show_reposts=false&show_teaser=false"
frameborder="0" name="so" style="display: none;"></iframe>
最佳答案
我想这可能就是您要找的。
让我解释一下发生了什么,以便您了解代码和样式的作用。
相册图片我加了两次,一次是背景,一次是做转盘。看起来像这样。
<img src="https://i1.sndcdn.com/artworks-000281899403-n7tdjo-t500x500.jpg" alt="img" class="img-circle -clipped">
<img src="https://i1.sndcdn.com/artworks-000281899403-n7tdjo-t500x500.jpg" alt="img" class="img-circle">
您看不到裁剪后的图像,只有在动画开始时才会注意到。
当玩家被点击时,添加-rotating
类来启动动画。
// Find the clippedImg and add the class -rotating to start the animation
var clippedImg = $(element).parent().find('.-clipped')[0];
$(clippedImg).addClass('-rotating');
当暂停按钮被点击时,-rotating
类被移除。
如果这就是您要找的,请告诉我。
关于javascript - Jimdo : Create rotating clipped disk on button click,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51933355/
关于w3total缓存工作机制,我在互联网上搜索,但找不到有关这两个的任何正确信息。w3Total 缓存中的磁盘增强型和磁盘基本型有什么区别?为什么磁盘增强型优于磁盘基本型?使用磁盘增强和磁盘缓存选项
我在启动时一直使用这两种方法,对我来说,功能是相同的。到目前为止,我创建的实例仅用于计算。我想知道 GCE 磁盘镜像和快照在技术方面有何不同,以及在哪种情况下使用其中一种更好。 最佳答案 快照反射(r
我正忙于迁移到 Azure 虚拟机。 我的 SQL Server 数据库 MDF 应该驻留在操作系统磁盘上还是数据磁盘上(据我所知,这是一个页 blob - 也称为 Azure 磁盘驱动器)? 我本以
背景 我一直在使用 Win32_DiskDrive 来查找闪存(USB 笔、SD 卡等),但在其他计算机上进行一些测试后,我发现它们并不总是被发现。因此,我使用 Win32_LogicalDisk,因
我知道 stackoverflow 中也有类似的问题: WIX:default directory in WixUI_InstallDir, WIX installer root directory
如何使用 Golang 包获取 Dispart 详细信息(磁盘名称(例如:磁盘 0)空闲和磁盘使用情况) 最佳答案 您可以使用此包 github.com/shirou/gopsutil 获取 disk
我希望能够确定CD驱动器中的音乐专辑CD。例如,如果某人声称驱动器中的CD是Eminem-Eminem Show,那么我希望能够验证CD确实是The Eminem Show。 有任何想法吗?我已经申请
我需要对文件执行随机更新。让我需要更新偏移量 k1、k2、....、kn 处的文件。从性能的角度来看,如果我按任何顺序写入是否重要,或者如果我按偏移量的递增顺序写入,性能会提高吗?更具体地说,我将在
关闭。这个问题是off-topic .它目前不接受答案。 想改善这个问题吗? Update the question所以它是 on-topic对于堆栈溢出。 10年前关闭。 Improve this
我准备发布一个只对普通硬盘有效的工具,而不是 SSD(固态硬盘)。事实上,它不应该与 SSD 一起使用,因为它会导致大量读/写而没有实际效果。 任何人都知道检测给定驱动器是否为固态的方法? 最佳答案
NSWorkspaceDidMountNotification 可以很好地获取刚刚安装的磁盘的信息。但是如何在我的应用程序启动之前获取已经安装的磁盘的信息? 命令行:“diskutil list”和“
NSWorkspaceDidMountNotification 可以很好地获取刚刚安装的磁盘的信息。但是如何在我的应用程序启动之前获取已经安装的磁盘的信息? 命令行:“diskutil list”和“
我想知道为什么我的模拟器不断增加它在磁盘上的大小。否则它的运行速度比第一次慢。有什么解决办法吗?我不希望我的模拟器也保存它的状态。这个怎么做? 最佳答案 我发现从设置>存储>释放空间从模拟器手机中删除
关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。 想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。 7年前关闭。 Improve thi
我想知道,是否有某种类型的光盘 ID 可以用来在我的数据库中搜索以查看该光盘是否已被扫描?所有光盘都是由我创建的,通常在 Windows 上刻录。 -编辑-我可以比较写入时间和卷标以查看光盘是否已被扫
fmdb 文档说,如果您将文件系统路径传递给databaseWithPath:它将为您创建一个文件: 文件系统路径。该文件不必存在于磁盘上。如果它不存在,则会为您创建。 我正在使用以下代码获取我的文件
在 Azure 中创建 Windows Server 虚拟机后,我注意到操作系统磁盘(C: 驱动器)大小只有 30GB。 我的印象是所有新虚拟机都有 127GB 操作系统磁盘大小。 (Expand t
我在Google dataproc中默认设置(4个vCPU,15GB Ram)创建了一个群集。 在完成几次养 pig 工作后,集群中有2-3个不健康的节点。 因此,我升级了工作虚拟机的vCPU(4至8
有人可以解释一下在以下上下文中刷新到磁盘的含义吗?如果我将数据写入文件系统上的日志,这是否意味着我将其放在磁盘上?在什么时候您会/应该将文件刷新到磁盘? This suggests a design
下面的输出属于 FAT32 磁盘文件。我想用 C 程序显示所有文件以及每个文件相应分配的扇区。 按照指南我什至无法找到根目录。 (示例1 - 在http://www.tavi.co.uk/phobos
我是一名优秀的程序员,十分优秀!