Skip to content

Commit

Permalink
Improve Animation options for Astroid Pro
Browse files Browse the repository at this point in the history
  • Loading branch information
sonvnn committed Oct 21, 2024
1 parent dee4ba1 commit 2fbe1d4
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 13 deletions.
7 changes: 4 additions & 3 deletions framework/elements/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
</fieldset>
<fieldset name="design-settings" label="ASTROID_ELEMENT_HEAD_DESIGN_SEETINGS_LABEL" addfieldpath="/libraries/astroid/framework/fields">
<field type="astroidgroup" name="general"/>
<field type="astroidgroup" name="animation_settings" title="ASTROID_ELEMENT_ANIMATION_SETTINGS_LABEL"/>
<field type="astroidgroup" name="spacing_settings" title="ASTROID_ELEMENT_HEAD_SPACING_LABEL"/>
<field type="astroidgroup" name="custom_settings" title="TPL_ASTROID_CUSTOM_CUSTOM_CSS_LABEL"/>
<field astroidgroup="general" name="astroid_element_visibility" type="astroidlist" label="ASTROID_ELEMENT_VISIBILITY_LABEL" default="allPage">
<option value="allPage">ASTROID_BANNER_VISIBILITY_OPTIONS_ALL</option>
<option value="currentPage">ASTROID_BANNER_VISIBILITY_OPTIONS_CURRENT_PAGE</option>
</field>

<field astroidgroup="general" name="animation" type="astroidanimations" label="ASTROID_ANIMATION"/>
<field astroidgroup="general" ngShow="[animation]!=''" name="animation_delay" class="form-control" type="astroidtext" hint="500" default="500" label="ASTROID_ANIMATION_DELAY" description="ASTROID_ANIMATION_DELAY_DESC"/>
<field astroidgroup="general" ngShow="[animation]!=''" name="animation_duration" class="form-control" type="astroidtext" hint="500" default="500" label="ASTROID_ANIMATION_DURATION" description="ASTROID_ANIMATION_DURATION_DESC"/>
<field astroidgroup="animation_settings" name="animation" type="astroidanimations" label="ASTROID_ANIMATION"/>
<field astroidgroup="animation_settings" ngShow="[animation]!=''" name="animation_delay" class="form-control" type="astroidtext" hint="500" default="500" label="ASTROID_ANIMATION_DELAY" description="ASTROID_ANIMATION_DELAY_DESC"/>
<field astroidgroup="animation_settings" ngShow="[animation]!=''" name="animation_duration" class="form-control" type="astroidtext" hint="500" default="500" label="ASTROID_ANIMATION_DURATION" description="ASTROID_ANIMATION_DURATION_DESC"/>

<field astroidgroup="general" name="max_width" type="astroidlist" label="ASTROID_WIDGET_MAX_WIDTH_LABEL" description="ASTROID_WIDGET_MAX_WIDTH_DESC" default="">
<option value="">JGLOBAL_INHERIT</option>
Expand Down
4 changes: 3 additions & 1 deletion framework/elements/grid/grid.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
</fields>
</form>
</field>
<field type="astroidhidden" name="animation_element" default=".as-grid" />
<field astroidgroup="grid_options" name="column_responsive" type="astroidradio" width="full" default="lg">
<option value="xxl">ASTROID_WIDGET_XXL_ICON</option>
<option value="xl">ASTROID_WIDGET_XL_ICON</option>
Expand Down Expand Up @@ -558,6 +557,9 @@
<option value="5">J5</option>
</field>
</fieldset>
<fieldset name="design-settings" label="ASTROID_ELEMENT_HEAD_DESIGN_SEETINGS_LABEL" addfieldpath="/libraries/astroid/framework/fields">
<field astroidgroup="animation_settings" ngShow="[animation]!=''" name="animation_element" type="astroidtext" default=".as-grid" label="ASTROID_ANIMATION_ELEMENT" description="ASTROID_ANIMATION_ELEMENT_DESC"/>
</fieldset>
<fieldset name="assignment-settings" label="TPL_ASTROID_ASSIGNMENT_SETTINGS_LABEL" addfieldpath="/libraries/astroid/framework/fields" articleData="false">
<field type="astroidlist" name="assignment_type" label="ASTROID_WIDGET_ASSIGN" default="1">
<option value="1">ASTROID_WIDGET_ON_ALL_PAGES</option>
Expand Down
3 changes: 3 additions & 0 deletions framework/elements/testimonials/testimonials.xml
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,9 @@
<field astroidgroup="rating_options" name="enable_rating" type="astroidradio" astroid-switch="true" default="0" label="ASTROID_WIDGET_ENABLE_RATING"/>
<field astroidgroup="rating_options" name="rating_color" type="astroidcolor" label="ASTROID_WIDGET_RATING_COLOR"/>
</fieldset>
<fieldset name="design-settings" label="ASTROID_ELEMENT_HEAD_DESIGN_SEETINGS_LABEL" addfieldpath="/libraries/astroid/framework/fields">
<field astroidgroup="animation_settings" ngShow="[animation]!=''" name="animation_element" type="astroidtext" default=".card" label="ASTROID_ANIMATION_ELEMENT" description="ASTROID_ANIMATION_ELEMENT_DESC"/>
</fieldset>
<fieldset name="assignment-settings" label="TPL_ASTROID_ASSIGNMENT_SETTINGS_LABEL" addfieldpath="/libraries/astroid/framework/fields" articleData="false">
<field type="astroidlist" name="assignment_type" label="ASTROID_WIDGET_ASSIGN" default="1">
<option value="1">ASTROID_WIDGET_ON_ALL_PAGES</option>
Expand Down
5 changes: 5 additions & 0 deletions framework/library/astroid/Element.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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']);
Expand Down
28 changes: 20 additions & 8 deletions framework/library/astroid/Element/BaseElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}
}
2 changes: 1 addition & 1 deletion js/gmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ($) {
Expand Down
10 changes: 10 additions & 0 deletions language/en-GB/en-GB.astroid.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 <code>.card</code>"

; Article/Blogs
ASTROID_ARTICLE_OPTIONS_BASIC="Basic Options"
Expand Down

0 comments on commit 2fbe1d4

Please sign in to comment.