array($this, 'renderCallback'),
'editor_script' => 'akdev-spline-animation-script',
'title'=> ('Spline Animation'),
'icon'=> ('art'),
'category'=> ('animations'),
'description'=> ('Small block editor plugin to add spline animations to delight your user experience'),
'editor_style' => 'akdev-spline-animation-style' ,
'attributes'=>$blockDecode['attributes'],
));
// options page
function akdev_options_assets() {
wp_enqueue_style('akdev-spline-animation-style', plugin_dir_url(__FILE__) . 'build/style-index.css');
}
?>
AKDev Spline animation | Options
Check this box if you like to enable smooth scrolling for your animation pages.
How to use this plugin
post ) ) {
array_push(
$block_categories,
array(
'slug' => 'animations',
'title' => __( 'Animations', 'create-block' ),
'icon' => null,
)
);
}
return $block_categories;
}
add_filter( 'block_categories_all', 'filter_block_categories_when_post_provided', 10, 2 );
}
function renderCallback($attributes) {
if (!is_admin()) {
wp_enqueue_script('Gsap', 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js');
wp_enqueue_script('Gsap-scrolltrigger', 'https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/ScrollTrigger.min.js');
wp_enqueue_script('spline-akdev/frontend-script', plugin_dir_url(__FILE__) . 'build/client.js', array('wp-element'));
wp_enqueue_style('spline-akdev/frontend-styles', plugin_dir_url(__FILE__) . 'build/index.css');
}
$json = wp_json_encode($attributes);
$json = wp_json_encode($attributes);
$result = json_decode($json,true);
$customStyles = wp_json_encode($result['customStyles'],true);
$classNames = wp_json_encode($result['className'],true);
$customStyles = wp_json_encode($result['customStyles'],true);
$classNames = wp_json_encode($result['className'],true);
$classNamesData = json_decode($classNames, true);
$data = json_decode($customStyles, true);
$cssString = '';
if ($data) {
// Convert associative array to CSS style string
foreach ($data as $property => $value) {
$cssString .= $property . ':' . $value . ';';
}
}
ob_start();
?>
' data-attributes='' >