mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-07 05:39:05 +08:00
refactor: improve locate highlight animation (#9345)
This commit is contained in:
parent
27eef50b9f
commit
0e750c64db
@ -68,3 +68,23 @@
|
|||||||
transform-origin: center;
|
transform-origin: center;
|
||||||
animation: animation-rotate 0.75s linear infinite;
|
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' })
|
messageContainerRef.current.scrollIntoView({ behavior: 'smooth' })
|
||||||
if (highlight) {
|
if (highlight) {
|
||||||
setTimeoutTimer(
|
setTimeoutTimer(
|
||||||
'messageHighlightHandler_1',
|
'messageHighlightHandler',
|
||||||
() => {
|
() => {
|
||||||
const classList = messageContainerRef.current?.classList
|
const classList = messageContainerRef.current?.classList
|
||||||
classList?.add('message-highlight')
|
classList?.add('animation-locate-highlight')
|
||||||
setTimeoutTimer('messageHighlightHandler_2', () => classList?.remove('message-highlight'), 2500)
|
|
||||||
|
const handleAnimationEnd = () => {
|
||||||
|
classList?.remove('animation-locate-highlight')
|
||||||
|
messageContainerRef.current?.removeEventListener('animationend', handleAnimationEnd)
|
||||||
|
}
|
||||||
|
|
||||||
|
messageContainerRef.current?.addEventListener('animationend', handleAnimationEnd)
|
||||||
},
|
},
|
||||||
500
|
500
|
||||||
)
|
)
|
||||||
@ -242,9 +248,6 @@ const MessageContainer = styled.div`
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
&.message-highlight {
|
|
||||||
background-color: var(--color-primary-mute);
|
|
||||||
}
|
|
||||||
.menubar {
|
.menubar {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity 0.2s ease;
|
transition: opacity 0.2s ease;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user