mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-24 10:40:07 +08:00
refactor: improve locate highlight animation (#9345)
This commit is contained in:
parent
27eef50b9f
commit
0e750c64db
@ -68,3 +68,23 @@
|
||||
transform-origin: center;
|
||||
animation: animation-rotate 0.75s linear infinite;
|
||||
}
|
||||
|
||||
// 定位高亮动画
|
||||
@keyframes animation-locate-highlight {
|
||||
0% {
|
||||
background-color: transparent;
|
||||
}
|
||||
10% {
|
||||
background-color: var(--color-primary-mute);
|
||||
}
|
||||
70% {
|
||||
background-color: var(--color-primary-mute);
|
||||
}
|
||||
100% {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
|
||||
.animation-locate-highlight {
|
||||
animation: animation-locate-highlight 2.5s ease-in-out;
|
||||
}
|
||||
|
||||
@ -127,11 +127,17 @@ const MessageItem: FC<Props> = ({
|
||||
messageContainerRef.current.scrollIntoView({ behavior: 'smooth' })
|
||||
if (highlight) {
|
||||
setTimeoutTimer(
|
||||
'messageHighlightHandler_1',
|
||||
'messageHighlightHandler',
|
||||
() => {
|
||||
const classList = messageContainerRef.current?.classList
|
||||
classList?.add('message-highlight')
|
||||
setTimeoutTimer('messageHighlightHandler_2', () => classList?.remove('message-highlight'), 2500)
|
||||
classList?.add('animation-locate-highlight')
|
||||
|
||||
const handleAnimationEnd = () => {
|
||||
classList?.remove('animation-locate-highlight')
|
||||
messageContainerRef.current?.removeEventListener('animationend', handleAnimationEnd)
|
||||
}
|
||||
|
||||
messageContainerRef.current?.addEventListener('animationend', handleAnimationEnd)
|
||||
},
|
||||
500
|
||||
)
|
||||
@ -242,9 +248,6 @@ const MessageContainer = styled.div`
|
||||
padding: 10px;
|
||||
padding-bottom: 0;
|
||||
border-radius: 10px;
|
||||
&.message-highlight {
|
||||
background-color: var(--color-primary-mute);
|
||||
}
|
||||
.menubar {
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s ease;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user