LibAvion-2.0

From WowAce Wiki
Jump to: navigation, search

LibAvion-2.0 - API Documentation

Example addon

UNDER CONSTRUCTION

:TriggerAnimation(triggerID, animationTable)

Arguments

triggerID
string - a unique identifier, that allows to stop animation if needed.
animationTable
table - table that contains animations information, see extra section.

Notes

  • Will trigger the animation given by animationTable. As long as animation is still active it can be canceled with the given triggerID.

Example

 LibAvion:TriggerAnimation("HelloWorld", {...})

:StopAnimation(triggerID, fadeOut)

Arguments

triggerID
string - a unique identifier.
fadeOut
boolean - wether the frame should be smoothly faded out or just disappear.

Notes

  • Will cancel the given animation refered to by triggerID.
  • If fadeOut is true, frame will (slowly) fade out. (Will have no effect when frame is allready fading)

Example

 LibAvion:StopAnimation("HelloWorld", true)

:StopAllAnimations(fadeOut)

Arguments

fadeOut
boolean - wether the frame should be smoothly faded out or just disappear.

Notes

  • Will cancel all animations.
  • If fadeOut is true, frame will (slowly) fade out. (Will have no effect when frame is allready fading)

Example

 LibAvion:StopAllAnimations(false)

:IsAnimationRunning(triggerID)

Arguments

triggerID
string - a unique identifier.

Returns

isTrue
boolean - returns true if there is allread an animation with this identifier

Notes

  • Will return if animation with given identifier is allready running

Example

 if (LibAvion:IsAnimationRunning("HelloWorld")) then
	LibAvion:StopAnimation("HelloWorld", true)
 end

:Embed(target)

Arguments

target
table - library or addon to embed LibAvion-2.0 in.

Notes

  • Embeds methods from LibAvion-2.0 into target table.

Example

 LibStub:GetLibrary("LibCooldown-Item-2.0"):Embed(MyAddon)


AnimationTable format

Below you can see an overview of how the table needs to be formated, that is passed to ":TriggerAnimation(triggerID, animationTable)". You only should need to bother about this, when triggering an animation "by hand" without using all the neat addition in LibAvionEmbed-2.0.

{
alpha 		= Alpha value when its shown (number)
color 			= {
	r		= Red color when its shown (number)
	g 		= Green color when its shown (number)
	b 		= Blue color when its shown (number)
}
position 		= {
	x 		= X-Position on screen when its shown (number)
	y 		= Y-Position on screen when its shown (number)
}
size 			= {
	width 	= Width when its shown (number)
	height 	= Height when its shown (number)
}
rotation 		= Rotation of texture when its shown (number)
isAnimated 		= {
	color 		= Should color be animated? (bool)
	position 	= Should position be animated? (bool)
	scale 		= Should scale be animated? (bool)
	rotation 	= Should rotation be animated? (bool)
}
animation 		= {
	color 		= {
		r 	= Red color that is beeing animated to (number)
		g 	= Greem color that is beeing animated to (number)
		b 	= Blue color that is beeing animated to (number)
	}, 
	position 	= {
		x 	= X-Position that is beeing animated to (number)
		y 	= Y-Position that is beeing animated to (number)
	}, 
	scale 		= Scale that is beeing animated to (number)
	rotation 	= Rotations of texture that is beeing animated to (number)
}
animationFunc	= {
	alpha 	= Smoothness/speed of alpha animation (function)
	color 		= Smoothness/speed of color animation (function)
	position 	= Smoothness/speed of position animation (function)
	scale 		= Smoothness/speed of scale animation (function)
	rotation 	= Smoothness/speed of rotation animation (function)
}

NOTE: All of this functions HAVE to be pointers to function with head 
"function (param, rnd)", where <param> gonna be a value between 0 (start)
and 1 (end), depending on the time the animation is still running.
<rnd> is the value that can be set in the options dialogue under "Randomness",
its meant to add some random effect.

addRandom 		= {
	alpha 	= Add some randomness to alpha animation (number)
	color 		= Add some randomness to color animation (number)
	position 	= Add some randomness to position animation (number)
	scale 		= Add some randomness to scale animation (number)
	rotation 	= Add some randomness to rotation animation (number)
}
fadeMode 		= How to fade the frame

NOTE: 0 means, just fading; 1 means fade and coninue animation, 
2 means inverting animation when fading out

animationTime 	= The time the "animation" phase should take
fadeTime 		= The time it should take the frame to fade 
			out after completion (number)
waitTime 		= The time it should take from triggering the 
			animation until the actual animation should start 

NOTE: Can be used to create difficult multi-animations. (number)

showWhileWait 	= Allready show the frame/animation while
			 "waitTime" is yet running (bool)
textureFile 		= Texture file (file link, no SharedMedia!) to 
			the texture that should be used (string)
soundFile 		= Sound file (file link, no SharedMedia!) to 
			the sound that is triggered as soon as the 
			animation starts (string)
mirror 		= {
	x 		= Mirror texture on x-axis (bool)
	y 		= Mirror texture on y-axis (bool)
}
noEnd 		= The animation won't fade when its finished, but
			will rather need to be stopped with 
			LibAvion:StopAnimation(...) (bool)
}