Skip to content

FontAnimation Effect

MomoPewpew edited this page Dec 12, 2023 · 3 revisions

Description: Play an animation on the player's screen using a resource pack font and a rapidly updating Title effect.

Source Code

Configuration:

Option Description Variable Type Default Value
name The namespaced name of the font. This supports variable replacement. String ""
title-part Whether the animation should play out on the title, subtitle or actionbar. These have zoom levels of 4x, 2x and 1x respectively. String "subtitle"
prefix A text prefix that can be used for color codes. String null
interval How fast the animation plays. Animation fps = 20 / interval. Integer 1
duration How long the animation should last in ticks. Total played frames = duration / interval. Integer 20
start-frame The starting frame of the animation. Integer 0
floor-frame The frame number where the animation should start over if it loops. Integer 0
ceiling-frame The frame number where the animation should loop back to the floor-frame. Integer 999
reverse Whether the animation should play in reverse. This also flips the functions of the floor frame and ceiling frame. Boolean false
fade-in A fade-in time in ticks. The first frame will be held in place until the fade-in is over. Integer 0
fade-out A fade-out time in ticks. The last frame will be held in place until the fade-out is over. Integer 0

Example:

#Simple animation snippet
danger:
    spell-class: ".instant.DummySpell"
    effects:
        fontanimation:
            position: caster
            effect: fontanimation
            name: "dvz:danger_subtitle"
            duration: 37
#A demonstration of how to loop an animation
demonstration-fontanimation-loop:
    spell-class: ".instant.DummySpell"
    effects:
        fontanimation:
            position: caster
            effect: fontanimation
            name: "dvz:danger_subtitle"
            duration: 185
            floor-frame: 0
            ceiling-frame: 36
#A demonstration of how to start and end an animation at custom points
demonstration-fontanimation-customstart:
    spell-class: ".instant.DummySpell"
    effects:
        fontanimation:
            position: caster
            effect: fontanimation
            name: "dvz:danger_subtitle"
            duration: 37
            start-frame: 16
            floor-frame: 0
            ceiling-frame: 36
            fade-out: true
#A demonstration of an animation that loops so long as a buff is active. Also it's coloured magenta by using the prefix &d
danger-buff:
    spell-class: ".buff.DummySpell"
    toggle: true
    duration: 0
    effects:
        fontanimation:
            position: buff
            effect-interval: 37
            effect: fontanimation
            name: "dvz:danger_subtitle"
            duration: 37
            prefix: "&d"
#Using the "square" font which is a grey square with 50% transparency, to make a magenta overlay
overlay-magenta:
    spell-class: ".buff.DummySpell"
    toggle: true
    duration: 0
    effects:
        fontanimation:
            position: buff
            effect-interval: 1
            effect: fontanimation
            name: "dvz:square_title"
            title-part: title
            interval: 1
            fade-out: true
            duration: 1
            prefix: "&d"
##Black bars
black_bars:
    spell-class: ".MultiSpell"
    modifiers:
        - buffactive black_bars-loop castinstead black_bars-loop
    spells:
        - DELAY 20
        - black_bars-loop
    effects:
        fontanimation:
            position: caster
            effect: fontanimation
            name: "dvz:black_bars_title"
            title-part: title
            duration: 20

black_bars-loop:
    spell-class: ".buff.DummySpell"
    helper-spell: true
    toggle: true
    duration: 0
    spell-on-end: black_bars-hide
    effects:
        fontanimation:
            position: buff
            effect-interval: 1
            effect: fontanimation
            name: "dvz:black_bars_title"
            title-part: title
            start-frame: 19
            interval: 1
            fade-out: true
            duration: 1

black_bars-hide:
    spell-class: ".instant.DummySpell"
    helper-spell: true
    effects:
        fontanimation:
            position: caster
            effect: fontanimation
            name: "dvz:black_bars_title"
            title-part: title
            duration: 20
            ceiling-frame: 19
            reverse: true
##Variable replacement example
test-miningBar:
    spell-class: ".instant.DummySpell"
    effects:
        fontanimation:
            position: caster
            effect: fontanimation
            name: "lom:levelbars_mining_%var:animation_height:0%"
            start-frame: 24
            interval: 1
            duration: 20
            fade-in: 40
            fade-out: 40
Clone this wiki locally