- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
当您将鼠标悬停在它上面时,我正在尝试使用 CSS 关键帧制作 svg img 抖动。
这是我想要达到的效果:https://www.w3schools.com/code/tryit.asp?filename=FZ7CQHXPG42J
有一些 javascript 可以为相同的 svg 设置动画,但它以父 div #ellipse 为目标,当单击汉堡包图标时,它从左向右移动。我看不出它会如何干扰,但我添加它只是为了确保。
我在下面添加了相关代码。有关完整代码,请参阅网站。
// Other unrelated(!?) animations on #ellipse //
function moveEllipseRight() {
ellipse.animate([
// keyframes
{
transform: 'translateX(0px)'
},
{
transform: 'translateX(' + width + 'px)'
}
], {
// timing options
duration: 500,
iterations: 1,
easing: 'ease-in-out',
fill: 'forwards'
});
}
function moveEllipseLeft() {
ellipse.animate([
// keyframes
{
transform: 'translateX(' + width + 'px)'
},
{
transform: 'translateX(0px)'
}
], {
// timing options
duration: 500,
iterations: 1,
easing: 'ease-in-out',
fill: 'forwards'
});
}
#ellipse {
position: absolute;
top: 120px;
z-index: -99;
animation: 3s linear 0s slide 1;
left: -200px;
}
img.shake:hover {
animation: shake 0.5s;
animation-iteration-count: infinite;
}
@keyframes shake {
0% {
transform: translate(1px, 1px) rotate(0deg);
}
10% {
transform: translate(-1px, -2px) rotate(-1deg);
}
20% {
transform: translate(-3px, 0px) rotate(1deg);
}
30% {
transform: translate(3px, 2px) rotate(0deg);
}
40% {
transform: translate(1px, -1px) rotate(1deg);
}
50% {
transform: translate(-1px, 2px) rotate(-1deg);
}
60% {
transform: translate(-3px, 1px) rotate(0deg);
}
70% {
transform: translate(3px, 1px) rotate(-1deg);
}
80% {
transform: translate(-1px, -1px) rotate(1deg);
}
90% {
transform: translate(1px, 2px) rotate(0deg);
}
100% {
transform: translate(1px, -2px) rotate(-1deg);
}
}
<div id="ellipse">
<img src="https://lh5.googleusercontent.com/-yqttzktPkDY/AAAAAAAAAAI/AAAAAAAABGU/z6CVGRmY-C8/photo.jpg?sz=328" alt="ellipse" class="shake" width="400" height="400" />
</div>
最佳答案
问题出在您的 #ellipse
样式上。
#ellipse {
position: absolute;
top: 120px;
z-index: -99; /* remove this, it is not doing anything useful. */
animation: 3s linear 0s slide 1;
left: -200px;
}
问题是,悬停根本没有被触发,因为它位于 container
元素后面,因为负 z-index
。这个负 z 索引根本没有用,除非您打算将文本放在图像上方,而我在您的站点中看不到这种情况。
关于css - 悬停时的 SVG 摇动动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54181050/
我是gradle工具的新手,并获得了下一个项目。 TestNG测试某些类,并用@Test注释。 buid.gradle,那里有个小脚本。 test { dependsOn cleanRepor
有没有办法让 div 框在页面加载时抖动?比如可能只有一次或两次? 更新:在这个 URL 上我仍然无法加载页面,我做错了什么? http://tinyurl.com/79azbav 我想我卡在了页面加
我正在尝试为我的游戏调整 html 元素。 我在这里找到这段代码: shake = function (sprite, magnitude = 16, angular = false) { //A
我的意图是在用户执行摇动手势时清空 2 个数组内的值 - force[] 和 stiffness[],来自 prepareforsegue 的另一个类。下面是我的代码,然后是我遇到的错误。 sprin
您好,如果用户名/密码输入错误,我想让我的 div 摇动。我尝试过的方法显然行不通...我认为这可能与我使用 javascript 的方式有关。提前致谢。 HTML/PHP/JavaScript:
是否可以在显示主屏幕时摇动 iPhone 并打开我的应用程序? 例如:触发 (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)
我正在尝试在此代码中替换我的核心动画摇动效果 let shake = CAKeyframeAnimation(keyPath: "position.x") shake.values =
有时会出现创建目录mkdir的情况不是正确的工具。可能是git clone或rsync或mount 。所以当我们有这样的规则时: needDir dirs = filterM ((fmap not)
我需要创建一个带有子菜单的非常简单的响应式菜单。我目前遇到的问题是我的子菜单“抖动”,我不明白为什么。 谢谢! 这是我的HTML
我想在 Android 设备上捕捉“TAP”。例如,假设设备在用户的口袋里。然后他从口袋里摸了摸手机两次,并以一种特殊的方式摸了摸。比如说,用两个/三个手指敲打,比如“TAP -- TAP”。我想捕捉
在我的 iOS 应用程序中,我的屏幕上有一堆具有摆动效果的图标。当我按住其中一个时,它们开始摇晃(就像 iPhone 的菜单一样),但如果我按下主页按钮(将我的应用程序发送到后台),iPhone 就会
插入错误后,我想摇动一个文本字段。 为此,我编写了一个静态抖动动画 public static void shake(Node node) { TranslateTransition tt = n
我是一名优秀的程序员,十分优秀!