const OK_COLOR = '#16BFBF';
const NOK_COLOR = '#D0167C';
+ const CONFETTI_COLOR = '#E4FF19';
/**
* @param $vdir VirtualDirectory
*/
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'];
$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);
$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()