Animation Basics
Animations in BetterHud are defined using mathematical equations that control position over time:Animation Properties
Duration
The total length of the animation cycle in ticks (20 ticks = 1 second):Equations
Position equations use the variablet (current tick in the animation):
x-equation: Horizontal offset from base positiony-equation: Vertical offset from base position
Mathematical Functions
BetterHud supports various mathematical functions through the exp4j library:Trigonometric Functions
Basic Operations
Mathematical Constants
Advanced Functions
Common Animation Patterns
Oscillating Movement
Smooth back-and-forth motion:Circular Motion
Move in a circle:Linear Movement
Straight movement:Bounce Effect
Bouncing animation using absolute sine:Fade In/Out
While BetterHud doesn’t have opacity control, you can simulate fading with scale or position:Elastic Effect
Springy, elastic motion:Pulse Effect
Growing and shrinking:Popup Animations
Popups have special movement animations:Popup Move Properties
duration: Movement duration in seconds (not ticks)pixel.x-equation: Horizontal movementpixel.y-equation: Vertical movement
Popup Animation Examples
Slide Up
Slide Right and Fade
Arc Movement
Layout Animations
Layouts support repeating animations:Animation Timing
Loop Timing
Animations automatically loop based on duration:Synchronization
Multiple elements can have synchronized animations:Phase Offset
Create phase-shifted animations:Performance Considerations
Equation Complexity
Simple equations perform better:Animation Count
Limit simultaneous animations:- Keep layouts under 10 animated elements per screen
- Use animations only where needed
- Consider disabling animations for lower-end clients
Update Rate
Animation updates match the tick speed:Advanced Techniques
Multi-Stage Animations
Create complex multi-stage animations with conditionals:Easing Functions
Create smooth easing:Randomized Animations
Note: exp4j doesn’t have built-in random, but you can vary parameters:Debugging Animations
Testing Equations
Test equations at different time values:Common Issues
- Animation doesn’t move: Check if equation varies with
t - Animation too fast: Increase duration or decrease equation multiplier
- Animation too slow: Decrease duration or increase equation multiplier
- Equation error: Verify syntax and function names
Examples
Floating Health Bar
Damage Popup
Spinning Compass
Wave Effect
Next Steps
Layouts
Apply animations to layouts
Popups
Animate popups
Triggers
Combine with triggers
Images
Animate image elements
