-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9711315
commit 0499113
Showing
11 changed files
with
128 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
frontend/src/lib/components/common/button/PulseButton.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<script> | ||
export let pulseDuration = 1000 | ||
let pulseCount = 0 | ||
let isPulsing = false | ||
export function triggerPulse(count) { | ||
pulseCount = count | ||
if (!isPulsing) { | ||
isPulsing = true | ||
startPulse() | ||
} | ||
} | ||
function startPulse() { | ||
const interval = setInterval(() => { | ||
if (pulseCount <= 0) { | ||
clearInterval(interval) | ||
isPulsing = false | ||
} else { | ||
pulseCount-- | ||
} | ||
}, pulseDuration) | ||
} | ||
</script> | ||
|
||
<div class="relative"> | ||
<div | ||
class={`pulse ${pulseCount > 0 ? 'active' : ''}`} | ||
style={`--pulse-duration: ${pulseDuration}ms`} | ||
/> | ||
<slot /> | ||
</div> | ||
|
||
<style> | ||
.pulse { | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
width: 100%; | ||
height: 100%; | ||
background: radial-gradient(circle, rgba(0, 98, 255, 0.4) 0%, transparent 100%); | ||
border-radius: 50%; | ||
transform: translate(-50%, -50%) scale(1); | ||
z-index: 0; | ||
pointer-events: none; | ||
opacity: 0; | ||
} | ||
.pulse.active { | ||
animation: pulse var(--pulse-duration) ease-in infinite; | ||
opacity: 1; | ||
} | ||
@keyframes pulse { | ||
0% { | ||
transform: translate(-50%, -50%) scale(1); | ||
opacity: 0.8; | ||
} | ||
100% { | ||
transform: translate(-50%, -50%) scale(4); | ||
opacity: 0; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters