Skip to content

Commit 67267e7

Browse files
authored
Update fast-search-card.js
1 parent 8715a66 commit 67267e7

File tree

1 file changed

+22
-211
lines changed

1 file changed

+22
-211
lines changed

dist/fast-search-card.js

Lines changed: 22 additions & 211 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,12 +1253,19 @@ class FastSearchCard extends HTMLElement {
12531253
}
12541254

12551255
.category-buttons {
1256-
display: none;
1256+
display: none; /* Wird per JS auf 'flex' gesetzt */
12571257
flex-direction: row;
1258-
gap: 12px;
1259-
opacity: 0;
1260-
transform: translateX(20px);
1261-
filter: url(#categoryGooey); /* NEU: Filter anwenden */
1258+
gap: 0; /* WICHTIG: Kein Gap für Gooey-Effekt */
1259+
opacity: 1; /* Opacity wird nicht mehr animiert */
1260+
transform: none; /* Kein Transform mehr */
1261+
filter: url(#categoryGooey); /* ✅ BEHALTEN */
1262+
1263+
/* WICHTIG für die Animation */
1264+
position: relative; /* Positionierungs-Kontext für die Buttons */
1265+
width: 72px; /* Startbreite = 1 Button */
1266+
height: 72px;
1267+
padding: 0;
1268+
will-change: width, filter;
12621269
}
12631270

12641271
/* Mobile: Category-Buttons zentrieren */
@@ -1284,6 +1291,13 @@ class FastSearchCard extends HTMLElement {
12841291
cursor: pointer;
12851292
transition: all 0.2s ease;
12861293
background: var(--glass-shadow);
1294+
1295+
/* WICHTIG für die Animation */
1296+
position: absolute; /* Buttons absolut im Container positionieren */
1297+
top: 0;
1298+
left: 0;
1299+
flex-shrink: 0;
1300+
will-change: transform, opacity;
12871301
}
12881302

12891303
.category-button:hover {
@@ -4592,43 +4606,9 @@ class FastSearchCard extends HTMLElement {
45924606

45934607

45944608

4595-
/* NEU: SVG Gooey Filter für Liquid Animation */
4596-
.gooey-filter {
4597-
position: absolute;
4598-
width: 0;
4599-
height: 0;
4600-
pointer-events: none;
4601-
}
46024609

4603-
/* NEU: Spotlight Search Morphing */
4604-
.search-panel.morphing {
4605-
filter: url(#searchMorph);
4606-
transition: none !important;
4607-
}
4608-
4609-
.search-liquid-extension {
4610-
position: absolute;
4611-
top: 0;
4612-
right: 0;
4613-
width: 0;
4614-
height: 100%;
4615-
background: rgba(255, 255, 255, 0.15);
4616-
backdrop-filter: blur(var(--glass-blur-amount));
4617-
border-radius: 35px;
4618-
opacity: 0;
4619-
pointer-events: none;
4620-
will-change: transform, width, opacity;
4621-
}
4622-
4623-
.liquid-droplet {
4624-
position: absolute;
4625-
background: rgba(255, 255, 255, 0.15);
4626-
backdrop-filter: blur(var(--glass-blur-amount));
4627-
border-radius: 50%;
4628-
opacity: 0;
4629-
will-change: transform, opacity;
4630-
pointer-events: none;
4631-
}
4610+
4611+
46324612

46334613
</style>
46344614

@@ -4762,14 +4742,7 @@ class FastSearchCard extends HTMLElement {
47624742

47634743

47644744
</div>
4765-
4766-
4767-
<div class="search-liquid-extension" id="liquidExtension"></div>
4768-
<div class="liquid-droplet" id="mainDroplet"></div>
4769-
<div class="liquid-droplet" id="droplet1"></div>
4770-
<div class="liquid-droplet" id="droplet2"></div>
4771-
<div class="liquid-droplet" id="droplet3"></div>
4772-
<div class="liquid-droplet" id="droplet4"></div>
4745+
47734746

47744747
<div class="results-container">
47754748
<div class="subcategories">
@@ -5126,168 +5099,6 @@ class FastSearchCard extends HTMLElement {
51265099

51275100

51285101

5129-
// 🌊 ECHTE SPOTLIGHT ANIMATION METHODEN
5130-
5131-
startSpotlightAnimation() {
5132-
const searchPanel = this.shadowRoot.querySelector('.search-panel');
5133-
const liquidExtension = this.shadowRoot.querySelector('#liquidExtension');
5134-
const mainDroplet = this.shadowRoot.querySelector('#mainDroplet');
5135-
5136-
// 1. Suchleiste für Morphing vorbereiten
5137-
searchPanel.classList.add('morphing');
5138-
5139-
// 2. Animationssequenz starten
5140-
this.animateSearchMorphing(liquidExtension)
5141-
.then(() => this.animateDropletSeparation(liquidExtension, mainDroplet))
5142-
.then(() => this.animateDropletMigration(mainDroplet))
5143-
.then(() => this.animateDropletDivision())
5144-
.then(() => this.finalizeSpotlightAnimation());
5145-
}
5146-
5147-
animateSearchMorphing(liquidExtension) {
5148-
return new Promise((resolve) => {
5149-
// Liquid Extension aus der Suchleiste "wachsen" lassen
5150-
liquidExtension.style.display = 'block';
5151-
5152-
liquidExtension.animate([
5153-
{ width: '0px', opacity: 0 },
5154-
{ width: '100px', opacity: 1 }
5155-
], {
5156-
duration: 400,
5157-
easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
5158-
fill: 'forwards'
5159-
}).finished.then(() => {
5160-
setTimeout(resolve, 100);
5161-
});
5162-
});
5163-
}
5164-
5165-
animateDropletSeparation(liquidExtension, mainDroplet) {
5166-
return new Promise((resolve) => {
5167-
// Haupttropfen vom Extension "abtrennen"
5168-
const rect = liquidExtension.getBoundingClientRect();
5169-
5170-
mainDroplet.style.width = '72px';
5171-
mainDroplet.style.height = '72px';
5172-
mainDroplet.style.left = '100px';
5173-
mainDroplet.style.top = '0px';
5174-
mainDroplet.style.display = 'block';
5175-
5176-
// Gleichzeitig: Extension schrumpft, Droplet erscheint
5177-
const extensionAnim = liquidExtension.animate([
5178-
{ width: '100px', opacity: 1 },
5179-
{ width: '0px', opacity: 0 }
5180-
], {
5181-
duration: 300,
5182-
easing: 'ease-in',
5183-
fill: 'forwards'
5184-
});
5185-
5186-
const dropletAnim = mainDroplet.animate([
5187-
{ opacity: 0, transform: 'scale(0)' },
5188-
{ opacity: 1, transform: 'scale(1)' }
5189-
], {
5190-
duration: 300,
5191-
easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
5192-
fill: 'forwards'
5193-
});
5194-
5195-
Promise.all([extensionAnim.finished, dropletAnim.finished]).then(() => {
5196-
setTimeout(resolve, 100);
5197-
});
5198-
});
5199-
}
5200-
5201-
animateDropletMigration(mainDroplet) {
5202-
return new Promise((resolve) => {
5203-
// Haupttropfen nach rechts bewegen
5204-
mainDroplet.animate([
5205-
{ transform: 'scale(1) translateX(0px)' },
5206-
{ transform: 'scale(1) translateX(150px)' }
5207-
], {
5208-
duration: 500,
5209-
easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
5210-
fill: 'forwards'
5211-
}).finished.then(() => {
5212-
setTimeout(resolve, 150);
5213-
});
5214-
});
5215-
}
5216-
5217-
animateDropletDivision() {
5218-
return new Promise((resolve) => {
5219-
const droplets = [
5220-
this.shadowRoot.querySelector('#droplet1'),
5221-
this.shadowRoot.querySelector('#droplet2'),
5222-
this.shadowRoot.querySelector('#droplet3'),
5223-
this.shadowRoot.querySelector('#droplet4')
5224-
];
5225-
5226-
// Finale Positionen für alle 5 Buttons (mainDroplet + 4 weitere)
5227-
const positions = [
5228-
{ x: 150, y: 0 }, // mainDroplet (schon da)
5229-
{ x: 234, y: 0 }, // droplet1
5230-
{ x: 318, y: 0 }, // droplet2
5231-
{ x: 402, y: 0 }, // droplet3
5232-
{ x: 486, y: 0 } // droplet4
5233-
];
5234-
5235-
// Alle 4 zusätzliche Droplets animieren
5236-
const animations = droplets.map((droplet, index) => {
5237-
droplet.style.width = '72px';
5238-
droplet.style.height = '72px';
5239-
droplet.style.left = '150px'; // Starten alle am mainDroplet
5240-
droplet.style.top = '0px';
5241-
droplet.style.display = 'block';
5242-
5243-
return droplet.animate([
5244-
{
5245-
opacity: 0,
5246-
transform: 'scale(0) translateX(0px)'
5247-
},
5248-
{
5249-
opacity: 1,
5250-
transform: `scale(1) translateX(${positions[index + 1].x - 150}px)`
5251-
}
5252-
], {
5253-
duration: 400,
5254-
delay: index * 100,
5255-
easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
5256-
fill: 'forwards'
5257-
});
5258-
});
5259-
5260-
Promise.all(animations.map(anim => anim.finished)).then(() => {
5261-
setTimeout(resolve, 200);
5262-
});
5263-
});
5264-
}
5265-
5266-
finalizeSpotlightAnimation() {
5267-
const searchPanel = this.shadowRoot.querySelector('.search-panel');
5268-
const categoryButtons = this.shadowRoot.querySelector('.category-buttons');
5269-
5270-
// Alle Droplets verstecken
5271-
const allDroplets = this.shadowRoot.querySelectorAll('.liquid-droplet');
5272-
allDroplets.forEach(droplet => {
5273-
droplet.style.display = 'none';
5274-
});
5275-
5276-
// Suchleiste zurücksetzen
5277-
searchPanel.classList.remove('morphing');
5278-
5279-
// Category-Buttons erscheinen lassen
5280-
categoryButtons.classList.add('visible');
5281-
categoryButtons.animate([
5282-
{ opacity: 0, transform: 'translateX(20px) scale(0.9)' },
5283-
{ opacity: 1, transform: 'translateX(0) scale(1)' }
5284-
], {
5285-
duration: 300,
5286-
easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
5287-
fill: 'forwards'
5288-
});
5289-
}
5290-
52915102

52925103

52935104
handleSubcategorySelect(selectedChip) {

0 commit comments

Comments
 (0)