Thread Tools Display Modes
Prev Previous Post   Next Post Next
07/03/15, 12:47 AM   #1
Capadillo
Join Date: Feb 2014
Posts: 12
smooth health bar animation

I'm attempting to create a smooth health bar animation for a personal project. The goal is to eventually make it as smooth as possible, smoothing over the jumps when you do get health back. If that makes sense. Here is what I have at the moment:
Lua Code:
  1. function Animate_SetWidth(self, changeWidthTo)
  2.     -- Make sure we have a timeline & animation.
  3.     if ( not self.animation ) then
  4.         self.timeline  = ANIMATION_MANAGER:CreateTimeline();
  5.         self.animation = self.timeline:InsertAnimation(ANIMATION_SIZE, self);
  6.     end
  7.     local width = self:GetWidth();
  8.     local height = self:GetHeight();
  9.     self.animation:SetStartAndEndWidth(width, changeWidthTo)
  10.     self.animation:SetStartAndEndHeight(height, height)
  11.     self.animation:SetDuration(500)
  12.     self.animation:SetEasingFunction(ZO_EaseOutQuadratic)
  13.    
  14.     self.timeline:PlayFromStart()
  15. end
So that brings me to my questions:
  1. Is this the best way to achieve what I want?
  2. And is there a way to stop it from the start-stop animation when regaining health/magicka/stamina?

EDIT: Changing the duration to 2 seconds makes it a little less jerky but makes it seem much slower.

EDIT2: Is possible to animate a statusbar rather then creating a blank control and adding on a backdrop?

Last edited by Capadillo : 07/03/15 at 07:22 AM.
  Reply With Quote
 

ESOUI » Developer Discussions » Lua/XML Help » smooth health bar animation


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off