@bebranded/bb-contents 1.0.54-beta → 1.0.55-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bb-contents.js +25 -17
  2. package/package.json +1 -1
package/bb-contents.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * BeBranded Contents
3
3
  * Contenus additionnels français pour Webflow
4
- * @version 1.0.54-beta
4
+ * @version 1.0.55-beta
5
5
  * @author BeBranded
6
6
  * @license MIT
7
7
  * @website https://www.bebranded.xyz
@@ -28,7 +28,7 @@
28
28
 
29
29
  // Configuration
30
30
  const config = {
31
- version: '1.0.54-beta',
31
+ version: '1.0.55-beta',
32
32
  debug: false, // Debug désactivé
33
33
  prefix: 'bb-', // utilisé pour générer les sélecteurs (data-bb-*)
34
34
  youtubeEndpoint: null, // URL du worker YouTube (à définir par l'utilisateur)
@@ -456,31 +456,35 @@
456
456
  console.log(`[bb-contents] Marquee ${index + 1}: INITIALISATION DE L'ANIMATION`);
457
457
 
458
458
  if (isVertical) {
459
- // Animation JavaScript pour le vertical - version 1.0.33-beta
459
+ // Animation JavaScript pour le vertical - défilement infini parfait
460
460
  const contentSize = finalHeight;
461
- const totalSize = contentSize * 4 + parseInt(gap) * 3; // 4 copies au lieu de 3
461
+ const gapSize = parseInt(gap);
462
+ const totalSize = contentSize * 4 + gapSize * 3; // 4 copies
462
463
 
463
464
  // Ajuster la hauteur du scrollContainer seulement si pas en mode auto
464
465
  if (!useAutoHeight) {
465
466
  scrollContainer.style.height = totalSize + 'px';
466
467
  }
467
468
 
468
- let currentPosition = direction === 'bottom' ? -contentSize - parseInt(gap) : 0;
469
- const step = (parseFloat(speed) * 2) / 60; // Vitesse différente
469
+ // Position initiale : commencer à la 2ème copie pour défilement infini
470
+ let currentPosition = direction === 'bottom' ? -(contentSize + gapSize) : 0;
471
+ const step = (parseFloat(speed) * 2) / 60;
470
472
  let isPaused = false;
471
473
 
472
- // Fonction d'animation JavaScript
474
+ // Fonction d'animation JavaScript avec défilement infini parfait
473
475
  const animate = () => {
474
476
  if (!isPaused) {
475
477
  if (direction === 'bottom') {
476
478
  currentPosition += step;
479
+ // Reset quand on arrive au début de la 1ère copie
477
480
  if (currentPosition >= 0) {
478
- currentPosition = -contentSize - parseInt(gap);
481
+ currentPosition = -(contentSize + gapSize);
479
482
  }
480
483
  } else {
481
484
  currentPosition -= step;
482
- if (currentPosition <= -contentSize - parseInt(gap)) {
483
- currentPosition = 0;
485
+ // Reset quand on arrive au début de la 4ème copie
486
+ if (currentPosition <= -(3 * (contentSize + gapSize))) {
487
+ currentPosition = -(2 * (contentSize + gapSize));
484
488
  }
485
489
  }
486
490
 
@@ -502,27 +506,31 @@
502
506
 
503
507
  // Marquee vertical créé avec animation JS
504
508
  } else {
505
- // Animation JavaScript pour l'horizontal - version 1.0.33-beta
509
+ // Animation JavaScript pour l'horizontal - défilement infini parfait
506
510
  const contentSize = finalWidth;
507
- const totalSize = contentSize * 4 + parseInt(gap) * 3;
511
+ const gapSize = parseInt(gap);
512
+ const totalSize = contentSize * 4 + gapSize * 3; // 4 copies
508
513
  scrollContainer.style.width = totalSize + 'px';
509
514
 
510
- let currentPosition = direction === 'right' ? -contentSize - parseInt(gap) : 0;
515
+ // Position initiale : commencer à la 2ème copie pour défilement infini
516
+ let currentPosition = direction === 'right' ? -(contentSize + gapSize) : 0;
511
517
  const step = (parseFloat(speed) * 0.5) / 60; // Vitesse réduite pour l'horizontal
512
518
  let isPaused = false;
513
519
 
514
- // Fonction d'animation JavaScript
520
+ // Fonction d'animation JavaScript avec défilement infini parfait
515
521
  const animate = () => {
516
522
  if (!isPaused) {
517
523
  if (direction === 'right') {
518
524
  currentPosition += step;
525
+ // Reset quand on arrive au début de la 1ère copie
519
526
  if (currentPosition >= 0) {
520
- currentPosition = -contentSize - parseInt(gap);
527
+ currentPosition = -(contentSize + gapSize);
521
528
  }
522
529
  } else {
523
530
  currentPosition -= step;
524
- if (currentPosition <= -contentSize - parseInt(gap)) {
525
- currentPosition = 0;
531
+ // Reset quand on arrive au début de la 4ème copie
532
+ if (currentPosition <= -(3 * (contentSize + gapSize))) {
533
+ currentPosition = -(2 * (contentSize + gapSize));
526
534
  }
527
535
  }
528
536
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bebranded/bb-contents",
3
- "version": "1.0.54-beta",
3
+ "version": "1.0.55-beta",
4
4
  "description": "Contenus additionnels français pour Webflow",
5
5
  "main": "bb-contents.js",
6
6
  "scripts": {