Skip to content

Banner animations

The Banner animation plugin integrates GSAP into the eWizard.js framework, providing timeline-based animations for banner components. Animations are data-driven: JSON configuration defines what effects are available, and the <animation> block in each banner component controls what plays and when.

When the banner template initialises, eWizard.js framework merges the standard animations with custom animations defined at the template level (common/resources/animations.json by default). Each animation definition is registered as a named GSAP effect so it can be called by name from a timeline.

Each banner template you're animating contains an <animation> block in the template that defines the animation state.

<animation> block

Place an <animation> block in a banner component's single-file component to declare the timeline for that banner. The block contains a single JSON object, where ID is required and its format is bannerId-timeline.

html
<animation>
{
  "timeline": {
    "id": "banner1-timeline",
    "defaults": { "ease": "ewizardjs.ease", "duration": 0.8 },
    "animations": [
      { "target": "#logo", "animation": "fadeIn", "position": 0 },
      { "target": "#title", "animation": "backInDown", "position": "+=0.2", "repeat": 0 },
      { "target": "#cta", "animation": "fadeInUp", "position": "+=0" }
    ]    
  }
}
</animation>

Timeline options

The timeline object inside the <animation> block accepts the following parameters to configure the timing and sequence behavior of the banner animation:

FieldTypeRequiredDescription
idstringYesUnique identifier passed to gsap.timeline({ id }), where ID is required and its format is bannerId-timeline.
defaultsobjectNoGSAP defaults vars applied to every animation in this timeline (e.g., ease, duration).
animationsarrayYesOrdered list of animation entries.

Animation entries

Each entry in animations describes one tween added to the timeline.

FieldTypeRequiredDescription
targetstringYesCSS selector for the element(s) to animate.
animationstringYesName of a registered animation effect (e.g., "fadeIn").
positionstring | numberYesTimeline position. (default = "+=0") - controls the insertion point in the timeline. For more details, see Position Syntax.
varsobjectNoPer-entry overrides for the animation's vars. The vars values have a higher priority over the timeline defaults and the animation definition and overrides them.

Variable merge order

Since animation variables can be declared at multiple levels within a template, eWizard.js resolves potential configuration conflicts by merging variables in the following order of precedence (from lowest to highest):

  1. Animation definition defaults (vars from animations.json).
  2. Timeline defaults.
  3. Entry-level vars.

Position syntax

The position field follows the standard GSAP timeline position parameter syntax.

ValueMeaning
0Absolute time at 0 seconds.
"+=0.5"0.5 s after the end of the previous tween.
"-=0.3"0.3 s before the end of the previous tween.
"<"Start at the same time as the previous tween.
"<0.2"0.2 s after the start of the previous tween.

Configuration files

The animation configuration file is a JSON configuration that defines animations available for use in banners.

Standard animations

The framework contains a set of built-in animations. These are available in every banner template without any additional configuration.

Custom animations (animations.json)

To add template-level animations, create a JSON file whose path is configured via path.common.animations in system settings (defaults to common/resources/animations.json).

json
{
  "animations": {
    "mySlideIn": {
      "title": "My Slide In",
      "group": { "name": "entrance", "title": "Entrance" },
      "type":  { "name": "slide",    "title": "Slide"    },
      "method": "from",
      "vars": {
        "duration": 0.6,
        "ease": "ewizardjs.ease",
        "xPercent": "-=120",
        "opacity": 0
      }
    }
  },
  "customEases": {
    "ease": {
      "data": "M0,0 C0.25,0.1 0.25,1 1,1"
    }
  }
}

Custom animations are merged on top of standard ones. If a custom animation key matches a standard key, the custom definition replaces the standard one entirely.

Animation definition schema

When defining custom animations in animations.json, use the following schema parameters to configure their metadata, easing, and properties for the editor UI:

FieldTypeRequiredDescription
titlestringYesHuman-readable name displayed in eWizard Editor.
enabledbooleanNoSet to false to disable the animation (default true).
groupobjectYesGrouping metadata: { name, title }. Values: entrance, exit, emphasis. Only these 3 animation groups are supported by eWizard Editor.
typeobjectYesType metadata: { name, title }. E.g., fade, slide, bounce. title is a human-readable name displayed in eWizard Editor.
methodstringYesGSAP method: to, from, or fromTo.
varsobjectYesGSAP tween vars. May include special properties like startAt and keyframes, and others, as well as CSS properties you want to animate. Please note that for the fromTo GSAP method, fromVars is also required.
vars.fromVarsobjectNoFor the fromTo method only: the starting state object containing the initial (starting) property/value pairs only for the fromTo method. Don't add any special properties here like duration, ease,and so on – those go in the vars property.

fromTo example

The following example illustrates how to configure a custom crossFade animation using the fromTo method, detailing both the starting configuration (fromVars) and the target state variables:

json
{
  "crossFade": {
    "title": "Cross Fade",
    "group": { "name": "entrance", "title": "Entrance" },
    "type":  { "name": "fade",     "title": "Fade"     },
    "method": "fromTo",
    "vars": {
      "fromVars": { "opacity": 0 },
      "opacity": 1,
      "duration": 1,
      "ease": "ewizardjs.ease"
    }
  }
}

Custom eases

Define template-level easing curves in the customEases section of your custom animations.json. Each entry is registered via GSAP's CustomEase.

All custom ease names are automatically prefixed with ewizardjs. You define them without the prefix; you reference them with the prefix.

json
{
  "animations": {},
  "customEases": {
    "snappy": {
      "data": "M0,0 C0.4,0 0.2,1 1,1"
    }
  }
}

An example of a custom ease usage in your animation vars:

json
{ "ease": "ewizardjs.snappy" }

In addition to the standard GSAP eases, eWizard.js offers its own in-built eases:

Reference nameDescription
ewizardjs.easeDefault smooth ease.
ewizardjs.easeInBackEase in with slight overshoot back.
ewizardjs.easeInCubicCubic ease in.
ewizardjs.easeOutBackEase out with slight overshoot.
ewizardjs.easeOutQuartQuartic ease out.

Overriding standard animations

Define an entry in your custom animations.json with the same key as the standard animation. The custom definition replaces the standard one completely.

json
{
  "animations": {
    "fadeIn": {
      "title": "Fade in (custom)",
      "group": { "name": "entrance", "title": "Entrance" },
      "type":  { "name": "fade",     "title": "Fade"     },
      "method": "from",
      "vars": {
        "duration": 0.4,
        "ease": "ewizardjs.easeInBack",
        "opacity": 0
      }
    }
  }
}

Disabling standard animations

To remove a standard animation from the registry entirely, define it in the custom animations.json configuration file with "enabled": false:

json
{
  "animations": {
    "bounce": {
      "enabled": false
    }
  }
}

As a result, bounce will no longer be registered and will not be available for use in any banner animation.

Standard animation reference

The eWizard.js framework provides a set of pre-configured, standard animations. You can reference any of these animation keys directly within your template's <animation> block.

Entrance

KeyTitle
fadeInFade in
fadeInDownFade from top
fadeInUpFade from bottom
fadeInLeftFade from left
fadeInRightFade from right
fadeInTopLeftFade from top-left
fadeInTopRightFade from top-right
fadeInBottomLeftFade from bottom-left
fadeInBottomRightFade from bottom-right
backInDownFly in from top
backInLeftFly in from left
backInRightFly in from right
backInUpFly in from bottom
bounceInBounce in
bounceInDownBounce from top
bounceInLeftBounce from left
bounceInRightBounce from right
bounceInUpBounce from bottom
rotateInRotate in
rotateInDownLeftRotate from top-left
rotateInDownRightRotate from top-right
rotateInUpLeftRotate from bottom-left
rotateInUpRightRotate from bottom-right
slideInDownSlide down
slideInLeftSlide from left
slideInRightSlide from right
slideInUpSlide up
zoomInZoom in
zoomInDownZoom from top
zoomInLeftZoom from left
zoomInRightZoom from right
zoomInUpZoom from bottom

Emphasis

KeyTitle
bounceBounce
heartBeatHeartbeat
pulsePulse
rubberBandRubber
shakeXShake X
shakeYShake Y
swingSwing

Exit

KeyTitle
fadeOutFade out
fadeOutDownFade to bottom
fadeOutUpFade to top
fadeOutLeftFade to left
fadeOutRightFade to right
fadeOutTopLeftFade to top-left
fadeOutTopRightFade to top-right
fadeOutBottomLeftFade to bottom-left
fadeOutBottomRightFade to bottom-right
backOutDownFly out to bottom
backOutLeftFly out to left
backOutRightFly out to right
backOutUpFly out to top
bounceOutBounce out
bounceOutDownBounce to bottom
bounceOutLeftBounce to left
bounceOutRightBounce to right
bounceOutUpBounce to top
rotateOutRotate out
rotateOutDownLeftRotate to bottom-left
rotateOutDownRightRotate to bottom-right
rotateOutUpLeftRotate to top-left
rotateOutUpRightRotate to top-right
slideOutDownSlide down
slideOutLeftSlide to left
slideOutRightSlide to right
slideOutUpSlide up
zoomOutZoom out
zoomOutDownZoom to bottom
zoomOutLeftZoom to left
zoomOutRightZoom to right
zoomOutUpZoom to top

Plugin API ($animation)

The eWizard.js framework exposes this.$animation in every Vue component instance with certain properties and methods.

Properties

PropertyTypeDescription
gsapgsapThe global GSAP instance. You can use this to call any GSAP API directly.
animationsListAnimationsListAll registered animations (standard + custom merged).
standardAnimationsListAnimationsConfigStandard animations only.
customAnimationsListAnimationsConfigCustom animations only.
hasAnimationsbooleantrue if the current banner has at least one animation defined in its timeline.
timelinegsap.core.Timeline | nullThe active GSAP timeline for the current banner, or null if none is built.

Methods

The $animation helper exposes utility methods to programmatically control timeline playback and execution states.

Timeline control

The following methods are available for you to pause, play, restart, or seek to a specific time within the active GSAP timeline:

ts
$animation.play(at?, suppress?): gsap.core.Timeline | undefined

Plays the current timeline from its current position, or from at if provided. Proxies directly to gsap.core.Timeline.play().


ts
$animation.pause(at?, suppress?): gsap.core.Timeline | undefined

Pauses the current timeline. Proxies to gsap.core.Timeline.pause().


ts
$animation.restart(includeDelay?, suppress?): gsap.core.Timeline | undefined

Restarts the current timeline from the beginning. Proxies to gsap.core.Timeline.restart().


ts
$animation.seek(time, suppress?): gsap.core.Timeline | undefined

Jumps to a specific time position in the timeline without affecting its playing state.