From 2fbe1d43573e6b8c37adb5675919d9ff117a679b Mon Sep 17 00:00:00 2001 From: Sonny Le Date: Mon, 21 Oct 2024 14:43:39 +0700 Subject: [PATCH] Improve Animation options for Astroid Pro --- framework/elements/default.xml | 7 +++-- framework/elements/grid/grid.xml | 4 ++- .../elements/testimonials/testimonials.xml | 3 ++ framework/library/astroid/Element.php | 5 ++++ .../library/astroid/Element/BaseElement.php | 28 +++++++++++++------ js/gmap.js | 2 +- language/en-GB/en-GB.astroid.ini | 10 +++++++ 7 files changed, 46 insertions(+), 13 deletions(-) diff --git a/framework/elements/default.xml b/framework/elements/default.xml index b67b6c10..edbc0b52 100644 --- a/framework/elements/default.xml +++ b/framework/elements/default.xml @@ -10,6 +10,7 @@
+ @@ -17,9 +18,9 @@ - - - + + + diff --git a/framework/elements/grid/grid.xml b/framework/elements/grid/grid.xml index 0137cece..abe7135f 100644 --- a/framework/elements/grid/grid.xml +++ b/framework/elements/grid/grid.xml @@ -82,7 +82,6 @@ - @@ -558,6 +557,9 @@
+
+ +
diff --git a/framework/elements/testimonials/testimonials.xml b/framework/elements/testimonials/testimonials.xml index 6c9a571f..8fddc436 100644 --- a/framework/elements/testimonials/testimonials.xml +++ b/framework/elements/testimonials/testimonials.xml @@ -463,6 +463,9 @@
+
+ +
diff --git a/framework/library/astroid/Element.php b/framework/library/astroid/Element.php index 3f2622a7..cd41e8ed 100644 --- a/framework/library/astroid/Element.php +++ b/framework/library/astroid/Element.php @@ -31,6 +31,7 @@ class Element public string $element_type = 'layout'; protected string $xml_file = ''; protected string $default_xml_file = ''; + protected string $default_pro_xml_file = ''; protected string $layout = ''; public array $params = []; public mixed $data = []; @@ -165,6 +166,10 @@ public function loadForm(): void if ($this->type !== 'subform') { $defaultXml = simplexml_load_file($this->default_xml_file); $this->form->load($defaultXml->form, false); + if ($this->mode !== 'article_data' && Helper::isPro()) { + $defaultXml = simplexml_load_file(ASTROID_PRO_PATH . DIRECTORY_SEPARATOR . 'elements' . DIRECTORY_SEPARATOR . 'default.xml'); + $this->form->load($defaultXml->form, false); + } } else { if ($this->subform['formtype'] == 'string') { $defaultXml = simplexml_load_string($this->subform['formsource']); diff --git a/framework/library/astroid/Element/BaseElement.php b/framework/library/astroid/Element/BaseElement.php index c91a5efd..59459bd0 100644 --- a/framework/library/astroid/Element/BaseElement.php +++ b/framework/library/astroid/Element/BaseElement.php @@ -363,16 +363,10 @@ protected function _animation(): void if (empty($animation)) { return; } - $animation_element = $this->params->get('animation_element', ''); $document = Framework::getDocument(); - if (!Helper::isPro()) { - $this->addAttribute('style', 'visibility: hidden;'); - } else { - if (!empty($animation_element)) { - $this->addAttribute('data-animation-element', $animation_element); - } - } + $this->addAttribute('data-animation', $animation); + $delay = $this->params->get('animation_delay', ''); if (!empty($delay)) { $this->addAttribute('data-animation-delay', $delay); @@ -382,6 +376,24 @@ protected function _animation(): void if (!empty($duration)) { $this->addAttribute('data-animation-duration', $duration); } + + if (!Helper::isPro()) { + $this->addAttribute('style', 'visibility: hidden;'); + } else { + $animation_element = $this->params->get('animation_element', ''); + if (!empty($animation_element)) { + $this->addAttribute('data-animation-element', $animation_element); + } + $animation_loop = $this->params->get('animation_loop', 0); + if (!empty($animation_loop)) { + $this->addAttribute('data-animation-loop', $this->params->get('animation_scrub', 0)); + } + $animation_easing = $this->params->get('animation_easing', 'power3'); + if ($animation_easing !== 'none' && $animation_easing !== 'steps') { + $animation_easing .= '.' . $this->params->get('animation_easing_type', 'out'); + } + $this->addAttribute('data-animation-ease', $animation_easing); + } $document->loadAnimation(); } } diff --git a/js/gmap.js b/js/gmap.js index 991801e3..289dcdeb 100644 --- a/js/gmap.js +++ b/js/gmap.js @@ -2,7 +2,7 @@ * @package Astroid Framework * @author Astroid Framework Team https://astroidframe.work * @copyright Copyright (C) 2024 AstroidFrame.work. - * @license https://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later + * @license https://www.gnu.org/licenses/gpl-3.0.html GNU/GPLv3 or Later */ (function ($) { diff --git a/language/en-GB/en-GB.astroid.ini b/language/en-GB/en-GB.astroid.ini index fc283619..585ceff7 100644 --- a/language/en-GB/en-GB.astroid.ini +++ b/language/en-GB/en-GB.astroid.ini @@ -816,6 +816,7 @@ ASTROID_ROW_GUTTER_XS_LABEL="Mobile Gutter" ASTROID_ROW_GUTTER_XS_DESC="XS Gutters are the padding between your columns in Mobile devices" ASTROID_ELEMENT_HEAD_SPACING_LABEL="Spacing" TPL_ASTROID_GENERAL_SETTINGS_LABEL="General Settings" +ASTROID_ELEMENT_ANIMATION_SETTINGS_LABEL="Animation Settings" ASTROID_EXTRA_LARGE_COLUMN_ORDER_LABEL="Extra Large Order" ASTROID_LARGE_COLUMN_ORDER_LABEL="Large Order" ASTROID_MEDIUM_COLUMN_ORDER_LABEL="Medium Order" @@ -871,6 +872,15 @@ ASTROID_ANIMATION_DELAY="Animation Delay" ASTROID_ANIMATION_DELAY_DESC="Animation delay time in millisecond." ASTROID_ANIMATION_DURATION="Animation Duration" ASTROID_ANIMATION_DURATION_DESC="Animation Duration time in millisecond." +ASTROID_ANIMATION_LOOP="Animation Loop" +ASTROID_ANIMATION_LOOP_DESC="Links the progress of the animation directly to the scrollbar so it acts like a scrubber." +ASTROID_ANIMATION_SCRUB_TIME="Scrub Time (s)" +ASTROID_ANIMATION_SCRUB_TIME_DESC="The amount of time (in seconds) that the playhead should take to "catch up", so scrub: 0.5 would cause the animation's playhead to take 0.5 seconds to catch up with the scrollbar's position. It's great for smoothing things out." +ASTROID_ANIMATION_EASING="Animation Easing" +ASTROID_ANIMATION_EASING_DESC="Easing is the primary way to change the timing of your animation. Simply changing the ease can adjust the entire feel and personality of your animation." +ASTROID_ANIMATION_EASING_TYPE="Animation Easing Type" +ASTROID_ANIMATION_ELEMENT="Animation Element" +ASTROID_ANIMATION_ELEMENT_DESC="You can choose exactly which elements in the block will receive the animation effect. For example .card" ; Article/Blogs ASTROID_ARTICLE_OPTIONS_BASIC="Basic Options"