From 4b09eedf8f3bf3d1242bd040ba62e946a44d30cc Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 29 Sep 2023 12:31:21 +0200 Subject: [PATCH] wait #6300 @1 --- app/Elearning/QuizCompiler/Animations.php | 15 ++++++++++++--- app/Models/QuizTheme.php | 6 +++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/Elearning/QuizCompiler/Animations.php b/app/Elearning/QuizCompiler/Animations.php index 3301c31d1..c5d78fc6d 100644 --- a/app/Elearning/QuizCompiler/Animations.php +++ b/app/Elearning/QuizCompiler/Animations.php @@ -13,6 +13,7 @@ trait Animations const OK_COLOR = '#16BFBF'; const NOK_COLOR = '#D0167C'; + const CONFETTI_COLOR = '#E4FF19'; /** * @param $vdir VirtualDirectory @@ -20,14 +21,19 @@ trait Animations */ protected function writeAnimations() { - $colors = [self::OK_COLOR => $this->theme->okColor, self::NOK_COLOR => $this->theme->nokColor]; + $colors = [ + self::OK_COLOR => $this->theme->okColor, + self::CONFETTI_COLOR => $this->theme->okColor, + self::NOK_COLOR => $this->theme->nokColor + ]; $animationReplace = []; + $animationPregReplace = []; // Replace colors foreach ($colors as $from => $to) { - $f = (new Color($from))->toLottie(); + $f = (new Color($from))->toLottie(5,true); $t = (new Color($to))->toLottie(); - $animationReplace['[' . $f[0] . ',' . $f[1] . ',' . $f[2]] = '[' . $t[0] . ',' . $t[1] . ',' . $t[2]; + $animationPregReplace['/\[' . $f[0] . ',' . $f[1] . ',' . $f[2] . '/'] = '[' . $t[0] . ',' . $t[1] . ',' . $t[2]; } // Replace font $font = FluidbookFont::getAvailableFonts()[$this->theme->font ?: 'SourceSans']; @@ -42,6 +48,9 @@ trait Animations $c = file_get_contents($file->getPathname()); $c = strtr($c, $animationReplace); + foreach ($animationPregReplace as $regex => $replace) { + $c = preg_replace($regex, $replace, $c); + } $animations[$file->getBasename('.' . $file->getExtension())] = $c; } $this->data['animations'] = new Data($animations); diff --git a/app/Models/QuizTheme.php b/app/Models/QuizTheme.php index 5285a643f..3b81c7a79 100644 --- a/app/Models/QuizTheme.php +++ b/app/Models/QuizTheme.php @@ -145,9 +145,9 @@ class QuizTheme extends ToolboxModel $this->addField('outroCustom', Checkbox::class, __('Définir une forme personnalisée')); $this->addField('outroImage', FluidbookThemeImage::class, __('Desktop'), ['hint' => __('Taille recommandée : :size', ['size' => '1200 x 680px']), 'when' => ['outroCustom' => 1]]); $this->addField('outroImageMobile', FluidbookThemeImage::class, __('Mobile'), ['hint' => __('Taille recommandée : :size', ['size' => '390 x 844px']), 'when' => ['outroCustom' => 1]]); - $this->addField('', FormSeparator::class, ''); - $this->addField('outroSuccessAnimation', FluidbookThemeImage::class, __('Animation de réussite'), ['hint' => __('390 x 390px')]); - $this->addField('outroFailAnimation', FluidbookThemeImage::class, __('Animation d\'échec'), ['hint' => __('390 x 390px')]); + //$this->addField('', FormSeparator::class, ''); + $this->addField('outroSuccessAnimation', Hidden::class, __('Animation de réussite'), ['hint' => __('390 x 390px')]); + $this->addField('outroFailAnimation', Hidden::class, __('Animation d\'échec'), ['hint' => __('390 x 390px')]); } public function getTextsColor() -- 2.39.5