/card/animations

DescriptionDescription

This filter allows to add custom animations to reveal cards in a grid.

ArgumentsArguments

ArgumentTypeDescription
$animationsarrayHolds registered card animations

ExampleExample

PHP
functions.php
function prefix_register_card_animations( $animations ) {

	// 'my_animation' corresponds to the animation slug.
	$animations['my_animation'] = [
		'name'    => __( 'My Animation', 'text-domain' ),
		'visible' => [
			'transform' => 'perspective(2000px) translateY(0) rotateY(0) scale(1)',
			'opacity'   => 1,
		],
		'hidden'  => [
			'transform-origin' => '50% 50%',
			'transform'        => 'perspective(2000px) translateY(-200px) rotateY(-360deg) scale(0.8)',
			'opacity'          => 0,
		],
	];

	return $animations;

}
add_filter( 'wp_grid_builder/card/animations', 'prefix_register_card_animations', 10, 1 );