我一直在寻找LiveCode的鼠标悬停效果,但我还没有得到它。 我想得到一个像这样的效果链接: Creating a Mouseover Fade Effect with jQuery如何在livecode的按钮上创建鼠标悬停效果?
这是在jQuery中创建的。它可以应用在LiveCode中吗?
我一直在寻找LiveCode的鼠标悬停效果,但我还没有得到它。 我想得到一个像这样的效果链接: Creating a Mouseover Fade Effect with jQuery如何在livecode的按钮上创建鼠标悬停效果?
这是在jQuery中创建的。它可以应用在LiveCode中吗?
如果不需要淡入/你可以在没有脚本的情况下完成翻转效果。只需导入这两个图像,然后将按钮的图标属性设置为一个图像的id,并将同一按钮的hoverIcon属性设置为另一个图像的id。
在脚本翻转效果方面,Scott的答案是点对点的,您可以使用mouseEnter和mouseLeave消息来创建任何您想要的视觉更改。如果你需要淡入/淡出效果,这将做到这一点:
- 创建一个新的按钮,使其透明,showName off,边框关闭。
- 导入你的两个图像。假设他们被命名为image1和image2。
- 设置按钮的下面的脚本:
on mouseEnter
set the effectRate to 500
lock screen for visual effect
set the icon of me to "image2"
unlock screen with visual effect dissolve
end mouseEnter
on mouseLeave
set the effectRate to 500
lock screen for visual effect
set the icon of me to "image1"
unlock screen with visual effect dissolve
end mouseLeave
这几乎正好产生像在你提供的链接的效果。你可以通过改变effectRate来改变溶解效果的速度;溶解速度较慢,溶解速度较慢。 (该effectRate以毫秒为单位)。
mouseEnter(后跟mouseLeave)与Web技术中的鼠标悬停相当。 LiveCode不具有内置淡入淡出效果,但可以通过更改对象的blendLevel属性来编写自己的淡入淡出效果。例如,添加下面的脚本到按钮使其淡出到80%透明度上的MouseEnter(鼠标悬停),并渐退不透明的鼠标离开:
on mouseEnter
repeat with N = 0 to 80 step 5
set blendLevel of me to N
end repeat
end mouseEnter
on mouseLeave
repeat with N = 80 to 0 step -5
set blendLevel of me to N
end repeat
end mouseLeave
这不是预期的效果,虽然这将是有益的。谢谢! –
on mousewithin put random(1000) end mousewithin
也可以解释一下。 – user4419336
在您的按钮,图形或其他对象的脚本,添加处理程序:上mousewithin 你想什么 结束mousewithin 当用户的鼠标是对象的矩形内,该脚本将被激活。 –
谢谢!我会尽可能快地尝试! –
它的工作原理!这只是混合如此顺利。谢谢! –