-
Notifications
You must be signed in to change notification settings - Fork 2
Fix the inifite carousel text. #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LeonardRuhmann
wants to merge
7
commits into
Lucas-BRT:development
Choose a base branch
from
LeonardRuhmann:development
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
07fc5c1
Refactor: Fix the infinite carousel text
LeonardRuhmann 5c8aa59
Merge branch 'fix-animation' into development
LeonardRuhmann cde1183
Merge branch 'Lucas-BRT:development' into development
LeonardRuhmann e777870
Style Feature: Add Fade-In and Fade-Out Effects to Infinite Carousel …
LeonardRuhmann 9519e81
Merge branch 'development' into development
LeonardRuhmann 2fde628
Merge branch 'Lucas-BRT:development' into development
LeonardRuhmann 47044e9
Refactor: Improved readability and scalability of the checkTextAndAdd…
LeonardRuhmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -1,44 +1,46 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <link rel="stylesheet" href="./style/index.css" /> | ||
| <link rel="manifest" href="./manifest.json"> | ||
| <link rel="icon" href="./icons/app_icons/72x72.png"> | ||
| <meta name="theme-color" content="#306EE7"> | ||
| <title>Kreck</title> | ||
| </head> | ||
| <body> | ||
| <div class="container"> | ||
| <div class="navegation"> | ||
| <div class="navegation-background"> | ||
| <div class="navegation-button actived"> | ||
| <h1>Tracks</h1> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <link rel="stylesheet" href="./style/index.css" /> | ||
| <link rel="manifest" href="./manifest.json" /> | ||
| <link rel="icon" href="./icons/app_icons/72x72.png" /> | ||
| <meta name="theme-color" content="#306EE7" /> | ||
| <title>Kreck</title> | ||
| </head> | ||
| <body> | ||
| <div class="container"> | ||
| <div class="navegation"> | ||
| <div class="navegation-background"> | ||
| <div class="navegation-button actived"> | ||
| <h1>Tracks</h1> | ||
| </div> | ||
| <div class="navegation-button"> | ||
| <h1><a href="./sounds.html">Sounds</a></h1> | ||
| </div> | ||
| </div> | ||
| <div class="navegation-button"> | ||
| <h1><a href="./sounds.html">Sounds</a></h1> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="content"></div> | ||
| <div class="playbackbar"> | ||
| <div class="playbackbar-informations"> | ||
| <div class="playbackbarTrack-name"></div> | ||
| </div> | ||
| <div class="playbackbar-buttons"> | ||
| <button id="playbackbar-previous"> | ||
| <img src="./icons/previous-icon.svg" alt="" /> | ||
| </button> | ||
| <button id="playbackbar-play"> | ||
| <img src="./icons/pause-icon.svg" alt="" /> | ||
| </button> | ||
| <button id="playbackbar-next"> | ||
| <img src="./icons/next-icon.svg" alt="" /> | ||
| </button> | ||
| <div class="content"></div> | ||
| <div class="playbackbar"> | ||
| <div class="playbackbar-informations"> | ||
| <div class="playback-track-name-container"> | ||
| <div class="playbackbar-track-name"></div> | ||
| </div> | ||
| </div> | ||
| <div class="playbackbar-buttons"> | ||
| <button id="playbackbar-previous"> | ||
| <img src="./icons/previous-icon.svg" alt="" /> | ||
| </button> | ||
| <button id="playbackbar-play"> | ||
| <img src="./icons/pause-icon.svg" alt="" /> | ||
| </button> | ||
| <button id="playbackbar-next"> | ||
| <img src="./icons/next-icon.svg" alt="" /> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <script type="module" src="./script/index.js"></script> | ||
| </body> | ||
| <script type="module" src="./script/index.js"></script> | ||
| </body> | ||
| </html> | ||
This file contains hidden or 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,32 @@ | ||
| import { addElementClass } from "./subcomponents/addElementClass.js"; | ||
| import { putFade } from "./subcomponents/putFade.js"; | ||
|
|
||
| function removeParentClass(element) { | ||
| element.parentElement.classList.remove("no-fade"); | ||
| } | ||
|
|
||
| export function checkTextAndAddCarousel(where) { | ||
| const element = document.querySelectorAll(`.${where}-track-name`); | ||
| const classFade = `${where}-name-fade`; | ||
|
|
||
| element.forEach((element) => { | ||
| const textElement = element.textContent; | ||
|
|
||
| if (textElement.length > 21 && textElement.length <= 40) { | ||
| addElementClass(element, "small", `${where}`); | ||
| removeParentClass(element); | ||
| putFade(classFade, `carousel-small-${where}`, 20000); | ||
| } else if (textElement.length > 40 && textElement.length <= 90) { | ||
| addElementClass(element, "medium", `${where}`); | ||
| removeParentClass(element); | ||
| putFade(classFade, `carousel-medium-${where}`, 25000); | ||
| } else if (textElement.length > 90) { | ||
| addElementClass(element, "large", `${where}`); | ||
| removeParentClass(element); | ||
| putFade(classFade, `carousel-large-${where}`, 30000); | ||
| } else { | ||
| element.className = `${where}-track-name `; | ||
| element.parentElement.classList.add("no-fade"); | ||
| } | ||
| }); | ||
| } |
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
3 changes: 3 additions & 0 deletions
3
src-mobile/script/components/subcomponents/addElementClass.js
This file contains hidden or 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,3 @@ | ||
| export function addElementClass(element, carouselSize, where) { | ||
| element.className = `carousel-${carouselSize}-${where} ${where}-track-name `; | ||
| } |
This file contains hidden or 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,38 @@ | ||
| export function putFade(classFade, carouselName, duration) { | ||
| const carousels = document.querySelectorAll(`.${carouselName}`); | ||
| const animationDuration = duration; | ||
|
|
||
| let animationStartTime = null; | ||
|
|
||
| // Function to toggle the "classFade" class based on animation progress | ||
| const toggleTrackNameFade = (progress) => { | ||
| carousels.forEach((carousel) => { | ||
| if (progress >= 0 && progress <= 20) { | ||
| carousel.parentElement.classList.remove(`${classFade}`); | ||
| } else { | ||
| carousel.parentElement.classList.add(`${classFade}`); | ||
| } | ||
| }); | ||
| }; | ||
|
|
||
| // Function to update the carousel based on current time and animation duration | ||
| const updateCarousel = () => { | ||
| const currentTime = Date.now(); | ||
| const elapsedTime = (currentTime - animationStartTime) % animationDuration; | ||
| const animationProgress = (elapsedTime / animationDuration) * 100; | ||
|
|
||
| toggleTrackNameFade(animationProgress); | ||
| requestAnimationFrame(updateCarousel); | ||
| }; | ||
|
|
||
| // Initialize animation start time on animation iteration | ||
| carousels.forEach((carousel) => { | ||
| carousel.addEventListener("animationiteration", () => { | ||
| animationStartTime = Date.now(); | ||
| }); | ||
| }); | ||
|
|
||
| // Start monitoring the carousel animation | ||
| animationStartTime = Date.now(); | ||
| requestAnimationFrame(updateCarousel); | ||
| } |
This file contains hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's missing the icon declaration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed whitin the next commit.