Documentation
¶
Overview ¶
Package animations contains my attempt to create a kind of "animations" in imgui.
Index ¶
- Constants
- type Animation
- type AnimatorWidget
- type EasingAlgorithm
- type EasingAlgorithmType
- type HoverColorAnimation
- type MoveAnimation
- func (m *MoveAnimation) Algorithm(algorithm EasingAlgorithmType) *MoveAnimation
- func (m *MoveAnimation) Bezier(points ...imgui.Vec2) *MoveAnimation
- func (m *MoveAnimation) BuildAnimation(animationPercentage float32, starter func())
- func (m *MoveAnimation) BuildNormal(starter func())
- func (m *MoveAnimation) Init()
- func (m *MoveAnimation) Reset()
- func (m *MoveAnimation) StartPos(startPos imgui.Vec2) *MoveAnimation
- type TransitionAnimation
Constants ¶
const ( DefaultFPS = 60 DefaultDuration = time.Second / 4 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Animation ¶
type Animation interface { // Init is called once, immediately on start. Init() // Reset is called whenever needs to restart animation. Reset() // BuildNormal is called every frame when animation is not running // starter is a link to Animator.Start BuildNormal(starter func()) // BuildAnimation is called when running an animation. // It receives the current animation progress as a float, where // 0 >= animationPercentage <= 1 // starter is a link to Animator.Start BuildAnimation(animationPercentage float32, starter func()) }
Animation is an interface implemented by each animation.
type AnimatorWidget ¶
type AnimatorWidget struct {
// contains filtered or unexported fields
}
AnimatorWidget is a manager for animation.
func (*AnimatorWidget) CurrentPercentageProgress ¶
func (a *AnimatorWidget) CurrentPercentageProgress() float32
func (*AnimatorWidget) Duration ¶
func (a *AnimatorWidget) Duration(duration time.Duration) *AnimatorWidget
Duration allows to specify duration value. CAUTION: it will take effect after next call to Start - not applied to currently plaid animation.
func (*AnimatorWidget) FPS ¶
func (a *AnimatorWidget) FPS(fps int) *AnimatorWidget
FPS allows to specify FPS value. CAUTION: it will take effect after next call to Start - not applied to currently plaid animation.
func (*AnimatorWidget) IsRunning ¶
func (a *AnimatorWidget) IsRunning() bool
IsRunning returns true if the animation is already running.
type EasingAlgorithm ¶ added in v1.2.0
type EasingAlgorithmType ¶ added in v1.2.0
type EasingAlgorithmType byte
EasingAlgorithmType represents a type of easing algorithm used for animation. Refer https://easings.net/
const ( EasingAlgNone EasingAlgorithmType = iota EasingAlgInSine EasingAlgOutSine EasingAlgInOutSine EasingAlgInBack EasingAlgOutBack EasingAlgInOutBack EasingAlgInElastic EasingAlgOutElastic EasingAlgInOutElastic EasingAlgInBounce EasingAlgOutBounce EasingAlgInOutBounce EasingAlgMax )
type HoverColorAnimation ¶
func HoverColor ¶
func HoverColor( widget giu.Widget, hoverColor, normalColor func() color.RGBA, hoverID, normalID giu.StyleColorID, ) *HoverColorAnimation
func HoverColorStyle ¶
func HoverColorStyle( widget giu.Widget, hover, normal giu.StyleColorID, ) *HoverColorAnimation
HoverColorStyle wraps HoverColor so that it automatically obtains the color for specified style values.
func (*HoverColorAnimation) BuildAnimation ¶
func (h *HoverColorAnimation) BuildAnimation(percentage float32, _ func())
func (*HoverColorAnimation) BuildNormal ¶
func (h *HoverColorAnimation) BuildNormal(starter func())
func (*HoverColorAnimation) Init ¶
func (h *HoverColorAnimation) Init()
func (*HoverColorAnimation) Reset ¶
func (h *HoverColorAnimation) Reset()
type MoveAnimation ¶ added in v1.2.0
type MoveAnimation struct {
// contains filtered or unexported fields
}
func Move ¶ added in v1.2.0
func Move(w func(starter func()) giu.Widget, posDelta imgui.Vec2) *MoveAnimation
func (*MoveAnimation) Algorithm ¶ added in v1.2.0
func (m *MoveAnimation) Algorithm(algorithm EasingAlgorithmType) *MoveAnimation
func (*MoveAnimation) Bezier ¶ added in v1.2.0
func (m *MoveAnimation) Bezier(points ...imgui.Vec2) *MoveAnimation
func (*MoveAnimation) BuildAnimation ¶ added in v1.2.0
func (m *MoveAnimation) BuildAnimation(animationPercentage float32, starter func())
func (*MoveAnimation) BuildNormal ¶ added in v1.2.0
func (m *MoveAnimation) BuildNormal(starter func())
func (*MoveAnimation) Init ¶ added in v1.2.0
func (m *MoveAnimation) Init()
func (*MoveAnimation) Reset ¶ added in v1.2.0
func (m *MoveAnimation) Reset()
func (*MoveAnimation) StartPos ¶ added in v1.2.0
func (m *MoveAnimation) StartPos(startPos imgui.Vec2) *MoveAnimation
type TransitionAnimation ¶
type TransitionAnimation struct {
// contains filtered or unexported fields
}
func Transition ¶
func Transition(renderer1, renderer2 func(starter func())) *TransitionAnimation
func (*TransitionAnimation) BuildAnimation ¶
func (t *TransitionAnimation) BuildAnimation(percentage float32, starter func())
func (*TransitionAnimation) BuildNormal ¶
func (t *TransitionAnimation) BuildNormal(starter func())
func (*TransitionAnimation) Init ¶
func (t *TransitionAnimation) Init()
func (*TransitionAnimation) Reset ¶
func (t *TransitionAnimation) Reset()