mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Create 'animation' file
This commit is contained in:
parent
dffc91045e
commit
323e3166f5
3
voxygen/src/hud/animation.rs
Normal file
3
voxygen/src/hud/animation.rs
Normal file
@ -0,0 +1,3 @@
|
||||
pub fn animation_timer(pulse: f32) -> f32 {
|
||||
(pulse * 4.0/* speed factor */).cos() * 0.5 + 0.8 //y=0.5cos(4x)+0.8
|
||||
}
|
@ -3,7 +3,7 @@ use super::{
|
||||
BUFF_COLOR, DEBUFF_COLOR, TEXT_COLOR,
|
||||
};
|
||||
use crate::{
|
||||
hud::{self, BuffPosition},
|
||||
hud::{self, animation::animation_timer, BuffPosition},
|
||||
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
GlobalState,
|
||||
};
|
||||
@ -104,7 +104,7 @@ impl<'a> Widget for BuffsBar<'a> {
|
||||
let mut event = Vec::new();
|
||||
let localized_strings = self.localized_strings;
|
||||
let buffs = self.buffs;
|
||||
let buff_ani = ((self.pulse * 4.0/* speed factor */).cos() * 0.5 + 0.8) + 0.5; //Animation timer
|
||||
let buff_ani = animation_timer(self.pulse) + 0.5; //Animation timer
|
||||
let pulsating_col = Color::Rgba(1.0, 1.0, 1.0, buff_ani);
|
||||
let norm_col = Color::Rgba(1.0, 1.0, 1.0, 1.0);
|
||||
let buff_position = self.global_state.settings.interface.buff_position;
|
||||
|
@ -4,6 +4,7 @@ use super::{
|
||||
};
|
||||
use crate::{
|
||||
game_input::GameInput,
|
||||
hud::animation::animation_timer,
|
||||
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||
window::KeyMouse,
|
||||
GlobalState,
|
||||
@ -356,7 +357,7 @@ impl<'a> Widget for Buttons<'a> {
|
||||
}
|
||||
// Unspent SP indicator
|
||||
if unspent_sp {
|
||||
let arrow_ani = (self.pulse * 4.0/* speed factor */).cos() * 0.5 + 0.8; //Animation timer
|
||||
let arrow_ani = animation_timer(self.pulse); //Animation timer
|
||||
Image::new(self.imgs.sp_indicator_arrow)
|
||||
.w_h(20.0, 11.0)
|
||||
.graphics_for(state.ids.spellbook_button)
|
||||
|
@ -1,3 +1,4 @@
|
||||
mod animation;
|
||||
mod bag;
|
||||
mod buffs;
|
||||
mod buttons;
|
||||
|
Loading…
Reference in New Issue
Block a user