我一直在尋找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 當用戶的鼠標是對象的矩形內,該腳本將被激活。 –
謝謝!我會盡可能快地嘗試! –
它的工作原理!這只是混合如此順利。謝謝! –