animation

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Rendered for js/wasm

Index

Constants

This section is empty.

Variables

View Source
var (
	// Most commonly used easing functions
	EaseIn    = EaseInCubic
	EaseOut   = EaseOutCubic
	EaseInOut = EaseInOutCubic

	// Smooth and natural feeling
	Smooth = EaseInOutSine

	// Quick and snappy
	Snappy = EaseOutBack

	// Bouncy and playful
	Bouncy = EaseOutBounce

	// Elastic and spring-like
	Elastic = EaseOutElastic
)

Predefined common easing functions

Functions

func AnimatedButton

func AnimatedButton(text string, onClick func(event js.Value), engine *AnimationEngine) vdom.Component

AnimatedButton creates an animated button with hover effects

func AnimatedCard

func AnimatedCard(title, content string, engine *AnimationEngine) vdom.Component

AnimatedCard creates an animated card component

func AnimatedList

func AnimatedList(items []string, engine *AnimationEngine) vdom.Component

AnimatedList creates an animated list with staggered item animations

func EaseInBack

func EaseInBack(t float64) float64

Back easing functions (overshoot)

func EaseInBounce

func EaseInBounce(t float64) float64

Bounce easing functions

func EaseInCirc

func EaseInCirc(t float64) float64

Circular easing functions

func EaseInCubic

func EaseInCubic(t float64) float64

Cubic easing functions

func EaseInElastic

func EaseInElastic(t float64) float64

Elastic easing functions (spring effect)

func EaseInExpo

func EaseInExpo(t float64) float64

Exponential easing functions

func EaseInOutBack

func EaseInOutBack(t float64) float64

func EaseInOutBounce

func EaseInOutBounce(t float64) float64

func EaseInOutCirc

func EaseInOutCirc(t float64) float64

func EaseInOutCubic

func EaseInOutCubic(t float64) float64

func EaseInOutElastic

func EaseInOutElastic(t float64) float64

func EaseInOutExpo

func EaseInOutExpo(t float64) float64

func EaseInOutQuad

func EaseInOutQuad(t float64) float64

func EaseInOutQuart

func EaseInOutQuart(t float64) float64

func EaseInOutQuint

func EaseInOutQuint(t float64) float64

func EaseInOutSine

func EaseInOutSine(t float64) float64

func EaseInQuad

func EaseInQuad(t float64) float64

Quadratic easing functions

func EaseInQuart

func EaseInQuart(t float64) float64

Quartic easing functions

func EaseInQuint

func EaseInQuint(t float64) float64

Quintic easing functions

func EaseInSine

func EaseInSine(t float64) float64

Sine easing functions

func EaseOutBack

func EaseOutBack(t float64) float64

func EaseOutBounce

func EaseOutBounce(t float64) float64

func EaseOutCirc

func EaseOutCirc(t float64) float64

func EaseOutCubic

func EaseOutCubic(t float64) float64

func EaseOutElastic

func EaseOutElastic(t float64) float64

func EaseOutExpo

func EaseOutExpo(t float64) float64

func EaseOutQuad

func EaseOutQuad(t float64) float64

func EaseOutQuart

func EaseOutQuart(t float64) float64

func EaseOutQuint

func EaseOutQuint(t float64) float64

func EaseOutSine

func EaseOutSine(t float64) float64

func Linear

func Linear(t float64) float64

Linear easing (no easing)

Types

type AnimatedComponent

type AnimatedComponent struct {
	// contains filtered or unexported fields
}

AnimatedComponent wraps any component with animation capabilities

func NewAnimatedComponent

func NewAnimatedComponent(child vdom.Component, engine *AnimationEngine) *AnimatedComponent

NewAnimatedComponent creates a new animated component wrapper

func (*AnimatedComponent) Render

func (ac *AnimatedComponent) Render() *vdom.VNode

Render renders the wrapped component with animation classes

type Animation

type Animation struct {
	ID         string
	StartTime  time.Time
	Duration   time.Duration
	Delay      time.Duration
	Easing     EasingFunc
	Properties []PropertyAnimation
	State      AnimationState
	Progress   float64
	OnStart    func()
	OnUpdate   func(progress float64)
	OnComplete func()
	OnCancel   func()
	// contains filtered or unexported fields
}

Animation represents a single animation instance

func Pulse

func Pulse(engine *AnimationEngine, element js.Value, scale float64, duration time.Duration) *Animation

Pulse creates a pulsing scale animation

type AnimationBuilder

type AnimationBuilder struct {
	// contains filtered or unexported fields
}

AnimationBuilder provides a fluent interface for creating animations

func NewAnimation

func NewAnimation() *AnimationBuilder

NewAnimation creates a new animation builder

func (*AnimationBuilder) Animate

func (ab *AnimationBuilder) Animate(property string, from, to interface{}, unit string) *AnimationBuilder

Animate adds a property animation

func (*AnimationBuilder) Build

func (ab *AnimationBuilder) Build() *Animation

Build returns the constructed animation

func (*AnimationBuilder) FadeIn

func (ab *AnimationBuilder) FadeIn() *AnimationBuilder

FadeIn animates opacity from 0 to 1

func (*AnimationBuilder) FadeOut

func (ab *AnimationBuilder) FadeOut() *AnimationBuilder

FadeOut animates opacity from current to 0

func (*AnimationBuilder) FadeTo

func (ab *AnimationBuilder) FadeTo(opacity float64) *AnimationBuilder

FadeTo animates opacity

func (*AnimationBuilder) MoveTo

func (ab *AnimationBuilder) MoveTo(x, y float64) *AnimationBuilder

MoveTo animates position

func (*AnimationBuilder) OnCancel

func (ab *AnimationBuilder) OnCancel(callback func()) *AnimationBuilder

OnCancel sets the onCancel callback

func (*AnimationBuilder) OnComplete

func (ab *AnimationBuilder) OnComplete(callback func()) *AnimationBuilder

OnComplete sets the onComplete callback

func (*AnimationBuilder) OnStart

func (ab *AnimationBuilder) OnStart(callback func()) *AnimationBuilder

OnStart sets the onStart callback

func (*AnimationBuilder) OnUpdate

func (ab *AnimationBuilder) OnUpdate(callback func(progress float64)) *AnimationBuilder

OnUpdate sets the onUpdate callback

func (*AnimationBuilder) RotateTo

func (ab *AnimationBuilder) RotateTo(degrees float64) *AnimationBuilder

RotateTo animates rotation

func (*AnimationBuilder) ScaleTo

func (ab *AnimationBuilder) ScaleTo(scale float64) *AnimationBuilder

ScaleTo animates scale

func (*AnimationBuilder) SetDelay

func (ab *AnimationBuilder) SetDelay(delay time.Duration) *AnimationBuilder

SetDelay sets the animation delay

func (*AnimationBuilder) SetDuration

func (ab *AnimationBuilder) SetDuration(duration time.Duration) *AnimationBuilder

SetDuration sets the animation duration

func (*AnimationBuilder) SetEasing

func (ab *AnimationBuilder) SetEasing(easing EasingFunc) *AnimationBuilder

SetEasing sets the easing function

func (*AnimationBuilder) SetElement

func (ab *AnimationBuilder) SetElement(element js.Value) *AnimationBuilder

SetElement sets the target DOM element

func (*AnimationBuilder) SetID

func (ab *AnimationBuilder) SetID(id string) *AnimationBuilder

SetID sets the animation ID

func (*AnimationBuilder) SlideDown

func (ab *AnimationBuilder) SlideDown(distance float64) *AnimationBuilder

SlideDown slides element down

func (*AnimationBuilder) SlideLeft

func (ab *AnimationBuilder) SlideLeft(distance float64) *AnimationBuilder

SlideLeft slides element to the left

func (*AnimationBuilder) SlideRight

func (ab *AnimationBuilder) SlideRight(distance float64) *AnimationBuilder

SlideRight slides element to the right

func (*AnimationBuilder) SlideUp

func (ab *AnimationBuilder) SlideUp(distance float64) *AnimationBuilder

SlideUp slides element up

type AnimationEngine

type AnimationEngine struct {
	// contains filtered or unexported fields
}

AnimationEngine manages all active animations

func NewAnimationEngine

func NewAnimationEngine(r *renderer.Renderer) *AnimationEngine

NewAnimationEngine creates a new animation engine

func (*AnimationEngine) AddAnimation

func (e *AnimationEngine) AddAnimation(anim *Animation)

AddAnimation adds a new animation to the engine

func (*AnimationEngine) GetActiveAnimations

func (e *AnimationEngine) GetActiveAnimations() []string

GetActiveAnimations returns a copy of active animation IDs

func (*AnimationEngine) OnNextFrame

func (e *AnimationEngine) OnNextFrame(callback func())

OnNextFrame schedules a callback for the next animation frame

func (*AnimationEngine) PauseAnimation

func (e *AnimationEngine) PauseAnimation(id string)

PauseAnimation pauses an animation by ID

func (*AnimationEngine) RemoveAnimation

func (e *AnimationEngine) RemoveAnimation(id string)

RemoveAnimation removes an animation by ID

func (*AnimationEngine) ResumeAnimation

func (e *AnimationEngine) ResumeAnimation(id string)

ResumeAnimation resumes a paused animation by ID

func (*AnimationEngine) Start

func (e *AnimationEngine) Start()

Start begins the animation loop

func (*AnimationEngine) Stop

func (e *AnimationEngine) Stop()

Stop stops the animation loop

type AnimationState

type AnimationState int

AnimationState represents the current state of an animation

const (
	AnimationPending AnimationState = iota
	AnimationRunning
	AnimationPaused
	AnimationComplete
	AnimationCancelled
)

type Color

type Color struct {
	R, G, B, A float64
}

Color utilities for color interpolation

func ParseColor

func ParseColor(colorStr string) Color

ParseColor parses a color string (hex, rgb, rgba)

func (Color) Lerp

func (c Color) Lerp(target Color, t float64) Color

Lerp interpolates between two colors

func (Color) ToString

func (c Color) ToString() string

ToString converts color to string

type EasingFunc

type EasingFunc func(float64) float64

EasingFunc defines the signature for easing functions

func CreateBezier

func CreateBezier(x1, y1, x2, y2 float64) EasingFunc

Custom easing function builders

func CreateSpring

func CreateSpring(tension, friction float64) EasingFunc

Spring easing with custom parameters

type FadeIn

type FadeIn struct {
	*AnimatedComponent
	// contains filtered or unexported fields
}

FadeIn creates a fade-in animation component

func NewFadeIn

func NewFadeIn(child vdom.Component, engine *AnimationEngine) *FadeIn

NewFadeIn creates a fade-in animated component

func (*FadeIn) Render

func (f *FadeIn) Render() *vdom.VNode

Render renders the fade-in component

func (*FadeIn) SetDelay

func (f *FadeIn) SetDelay(delay time.Duration) *FadeIn

SetDelay sets the animation delay

func (*FadeIn) SetDuration

func (f *FadeIn) SetDuration(duration time.Duration) *FadeIn

SetDuration sets the animation duration

func (*FadeIn) SetEasing

func (f *FadeIn) SetEasing(easing EasingFunc) *FadeIn

SetEasing sets the easing function

type FloatingEffect

type FloatingEffect struct {
	// contains filtered or unexported fields
}

FloatingEffect creates floating animations

func NewFloatingEffect

func NewFloatingEffect(engine *AnimationEngine) *FloatingEffect

NewFloatingEffect creates a new floating effect

func (*FloatingEffect) StartFloating

func (fe *FloatingEffect) StartFloating(element js.Value, amplitude float64, period time.Duration)

StartFloating starts a continuous floating animation

type GlowPulseEffect

type GlowPulseEffect struct {
	// contains filtered or unexported fields
}

GlowPulseEffect creates a pulsing glow effect

func NewGlowPulseEffect

func NewGlowPulseEffect(engine *AnimationEngine) *GlowPulseEffect

NewGlowPulseEffect creates a new glow pulse effect

func (*GlowPulseEffect) StartGlowPulse

func (gpe *GlowPulseEffect) StartGlowPulse(element js.Value, color Color, intensity float64, duration time.Duration)

StartGlowPulse starts a pulsing glow animation

type MagneticEffect

type MagneticEffect struct {
	// contains filtered or unexported fields
}

MagneticEffect creates a magnetic attraction effect

func NewMagneticEffect

func NewMagneticEffect(engine *AnimationEngine) *MagneticEffect

NewMagneticEffect creates a new magnetic effect

func (*MagneticEffect) AttractElements

func (me *MagneticEffect) AttractElements(elements []js.Value, centerX, centerY float64, strength float64, duration time.Duration)

AttractElements attracts elements to a central point

type Particle

type Particle struct {
	ID       string
	Element  js.Value
	Position Vector2
	Velocity Vector2
	Size     float64
	Color    Color
	Life     float64 // 0.0 to 1.0
	MaxLife  float64 // in seconds
	Gravity  float64
	Fade     bool
	Scale    bool
}

Particle represents a single particle in the system

type ParticleConfig

type ParticleConfig struct {
	Count    int
	MinSize  float64
	MaxSize  float64
	MinSpeed float64
	MaxSpeed float64
	LifeTime float64
	Gravity  float64
	Colors   []Color
	Fade     bool
	Scale    bool
}

ParticleConfig defines the configuration for particle creation

func DefaultParticleConfig

func DefaultParticleConfig() ParticleConfig

DefaultParticleConfig returns a default particle configuration

func FireworkConfig

func FireworkConfig() ParticleConfig

FireworkConfig creates a firework-like particle burst

func MagicConfig

func MagicConfig() ParticleConfig

MagicConfig creates a magical particle effect

func SparkleConfig

func SparkleConfig() ParticleConfig

SparkleConfig creates a gentle sparkle effect

type ParticleSystem

type ParticleSystem struct {
	// contains filtered or unexported fields
}

ParticleSystem manages a collection of particles

func NewParticleSystem

func NewParticleSystem(engine *AnimationEngine) *ParticleSystem

NewParticleSystem creates a new particle system

func (*ParticleSystem) Clear

func (ps *ParticleSystem) Clear()

Clear removes all particles from the system

func (*ParticleSystem) CreateParticle

func (ps *ParticleSystem) CreateParticle(x, y float64, config ParticleConfig) *Particle

CreateParticle creates a new particle at the specified position

func (*ParticleSystem) CreateParticleBurst

func (ps *ParticleSystem) CreateParticleBurst(x, y float64, config ParticleConfig)

CreateParticleBurst creates a burst of particles at the specified position

func (*ParticleSystem) GetActiveParticleCount

func (ps *ParticleSystem) GetActiveParticleCount() int

GetActiveParticleCount returns the number of active particles

func (*ParticleSystem) SetupMouseClickHandler

func (ps *ParticleSystem) SetupMouseClickHandler(config ParticleConfig)

SetupMouseClickHandler sets up a global mouse click handler for particle bursts

type ParticleTrailEffect

type ParticleTrailEffect struct {
	// contains filtered or unexported fields
}

ParticleTrailEffect creates particle trails following mouse movement

func NewParticleTrailEffect

func NewParticleTrailEffect(engine *AnimationEngine, particleSystem *ParticleSystem) *ParticleTrailEffect

NewParticleTrailEffect creates a new particle trail effect

func (*ParticleTrailEffect) StartTrail

func (pte *ParticleTrailEffect) StartTrail(config ParticleConfig)

StartTrail starts the particle trail effect

func (*ParticleTrailEffect) StopTrail

func (pte *ParticleTrailEffect) StopTrail()

StopTrail stops the particle trail effect

type PropertyAnimation

type PropertyAnimation struct {
	Property    string
	From        interface{}
	To          interface{}
	Current     interface{}
	Unit        string // e.g., "px", "%", "deg"
	Interpolate func(from, to interface{}, progress float64) interface{}
}

PropertyAnimation represents an animated property

type RippleEffect

type RippleEffect struct {
	// contains filtered or unexported fields
}

RippleEffect creates a ripple animation

func NewRippleEffect

func NewRippleEffect(engine *AnimationEngine) *RippleEffect

NewRippleEffect creates a new ripple effect

func (*RippleEffect) CreateRipple

func (re *RippleEffect) CreateRipple(x, y float64, color Color, maxRadius float64, duration time.Duration)

CreateRipple creates a ripple effect at the specified position

type ScaleIn

type ScaleIn struct {
	*AnimatedComponent
	// contains filtered or unexported fields
}

ScaleIn creates a scale-in animation component

func NewScaleIn

func NewScaleIn(child vdom.Component, engine *AnimationEngine) *ScaleIn

NewScaleIn creates a scale-in animated component

func (*ScaleIn) Render

func (sc *ScaleIn) Render() *vdom.VNode

Render renders the scale-in component

func (*ScaleIn) SetDuration

func (sc *ScaleIn) SetDuration(duration time.Duration) *ScaleIn

SetDuration sets the animation duration

func (*ScaleIn) SetEasing

func (sc *ScaleIn) SetEasing(easing EasingFunc) *ScaleIn

SetEasing sets the easing function

func (*ScaleIn) SetScale

func (sc *ScaleIn) SetScale(from, to float64) *ScaleIn

SetScale sets the from and to scale values

type SlideIn

type SlideIn struct {
	*AnimatedComponent
	// contains filtered or unexported fields
}

SlideIn creates a slide-in animation component

func NewSlideIn

func NewSlideIn(child vdom.Component, engine *AnimationEngine) *SlideIn

NewSlideIn creates a slide-in animated component

func (*SlideIn) Render

func (s *SlideIn) Render() *vdom.VNode

Render renders the slide-in component

func (*SlideIn) SetDirection

func (s *SlideIn) SetDirection(direction string) *SlideIn

SetDirection sets the slide direction

func (*SlideIn) SetDistance

func (s *SlideIn) SetDistance(distance int) *SlideIn

SetDistance sets the slide distance

func (*SlideIn) SetDuration

func (s *SlideIn) SetDuration(duration time.Duration) *SlideIn

SetDuration sets the animation duration

func (*SlideIn) SetEasing

func (s *SlideIn) SetEasing(easing EasingFunc) *SlideIn

SetEasing sets the easing function

type Spring

type Spring struct {
	Position     float64
	Velocity     float64
	Target       float64
	Stiffness    float64
	Damping      float64
	Mass         float64
	RestDistance float64
}

Spring physics for natural animations

func NewSpring

func NewSpring(target float64) *Spring

NewSpring creates a new spring with default values

func (*Spring) IsAtRest

func (s *Spring) IsAtRest() bool

IsAtRest returns true if the spring is at rest

func (*Spring) Update

func (s *Spring) Update(deltaTime float64)

Update updates the spring physics

type Stagger

type Stagger struct {
	// contains filtered or unexported fields
}

Stagger creates staggered animations for multiple components

func NewStagger

func NewStagger(engine *AnimationEngine) *Stagger

NewStagger creates a new stagger animation

func (*Stagger) AddChild

func (s *Stagger) AddChild(child vdom.Component) *Stagger

AddChild adds a child component to the stagger

func (*Stagger) Render

func (s *Stagger) Render() *vdom.VNode

Render renders the staggered components

func (*Stagger) SetAnimation

func (s *Stagger) SetAnimation(animation func(vdom.Component, *AnimationEngine) vdom.Component) *Stagger

SetAnimation sets the animation function to apply to each child

func (*Stagger) SetStaggerTime

func (s *Stagger) SetStaggerTime(staggerTime time.Duration) *Stagger

SetStaggerTime sets the time between each animation

type TextMorphEffect

type TextMorphEffect struct {
	// contains filtered or unexported fields
}

TextMorphEffect creates a text morphing animation

func NewTextMorphEffect

func NewTextMorphEffect(engine *AnimationEngine) *TextMorphEffect

NewTextMorphEffect creates a new text morph effect

func (*TextMorphEffect) MorphTextToShape

func (tme *TextMorphEffect) MorphTextToShape(textElement js.Value, targetShape string, config ParticleConfig)

MorphTextToShape morphs text characters into a shape with particles

type Timeline

type Timeline struct {
	// contains filtered or unexported fields
}

Timeline manages complex animation sequences

func Bounce

func Bounce(engine *AnimationEngine, element js.Value, height float64, duration time.Duration) *Timeline

Bounce creates a bouncing animation

func NewTimeline

func NewTimeline(engine *AnimationEngine) *Timeline

NewTimeline creates a new animation timeline

func Parallel

func Parallel(engine *AnimationEngine, animations ...*Animation) *Timeline

Parallel creates a timeline with all animations running simultaneously

func Sequence

func Sequence(engine *AnimationEngine, animations ...*Animation) *Timeline

Sequence creates a timeline with animations running one after another

func Shake

func Shake(engine *AnimationEngine, element js.Value, intensity float64, duration time.Duration) *Timeline

Shake creates a shake animation

func StaggerTimeline

func StaggerTimeline(engine *AnimationEngine, staggerDelay time.Duration, animations ...*Animation) *Timeline

StaggerTimeline creates a timeline with animations starting at staggered intervals

func TypeWriter

func TypeWriter(engine *AnimationEngine, element js.Value, text string, charDelay time.Duration) *Timeline

TypeWriter creates a typewriter text animation

func Wiggle

func Wiggle(engine *AnimationEngine, element js.Value, angle float64, duration time.Duration) *Timeline

Wiggle creates a wiggling rotation animation

func (*Timeline) AddAnimation

func (t *Timeline) AddAnimation(startTime time.Duration, anim *Animation) *Timeline

AddAnimation adds an animation to the timeline at a specific time

func (*Timeline) AddAnimationAfter

func (t *Timeline) AddAnimationAfter(anim *Animation) *Timeline

AddAnimationAfter adds an animation after the previous one completes

func (*Timeline) AddAnimationWith

func (t *Timeline) AddAnimationWith(anim *Animation) *Timeline

AddAnimationWith adds an animation to run simultaneously with the last added animation

func (*Timeline) GetDuration

func (t *Timeline) GetDuration() time.Duration

GetDuration returns the total timeline duration

func (*Timeline) GetPlayhead

func (t *Timeline) GetPlayhead() time.Duration

GetPlayhead returns the current playhead position

func (*Timeline) GetProgress

func (t *Timeline) GetProgress() float64

GetProgress returns the current timeline progress (0.0 to 1.0)

func (*Timeline) IsComplete

func (t *Timeline) IsComplete() bool

IsComplete returns true if the timeline has completed

func (*Timeline) IsPaused

func (t *Timeline) IsPaused() bool

IsPaused returns true if the timeline is paused

func (*Timeline) IsPlaying

func (t *Timeline) IsPlaying() bool

IsPlaying returns true if the timeline is currently playing

func (*Timeline) OnComplete

func (t *Timeline) OnComplete(callback func()) *Timeline

OnComplete sets a callback for when the timeline completes

func (*Timeline) OnUpdate

func (t *Timeline) OnUpdate(callback func(progress float64)) *Timeline

OnUpdate sets a callback for timeline progress updates

func (*Timeline) Pause

func (t *Timeline) Pause()

Pause pauses the timeline

func (*Timeline) Play

func (t *Timeline) Play()

Play starts the timeline

func (*Timeline) Resume

func (t *Timeline) Resume()

Resume resumes the timeline

func (*Timeline) Seek

func (t *Timeline) Seek(seekTime time.Duration)

Seek moves the playhead to a specific time

func (*Timeline) SetLoop

func (t *Timeline) SetLoop(loop bool) *Timeline

SetLoop enables or disables timeline looping

func (*Timeline) Stop

func (t *Timeline) Stop()

Stop stops the timeline

func (*Timeline) Update

func (t *Timeline) Update()

Update updates the timeline (called by the animation engine)

type TimelineAnimation

type TimelineAnimation struct {
	StartTime time.Duration
	Animation *Animation
}

TimelineAnimation represents an animation within a timeline

type TimelineBuilder

type TimelineBuilder struct {
	// contains filtered or unexported fields
}

TimelineBuilder provides a fluent interface for building complex timelines

func NewTimelineBuilder

func NewTimelineBuilder(engine *AnimationEngine) *TimelineBuilder

NewTimelineBuilder creates a new timeline builder

func (*TimelineBuilder) At

func (tb *TimelineBuilder) At(time time.Duration, anim *Animation) *TimelineBuilder

At adds an animation at a specific time

func (*TimelineBuilder) Build

func (tb *TimelineBuilder) Build() *Timeline

Build returns the constructed timeline

func (*TimelineBuilder) Loop

func (tb *TimelineBuilder) Loop() *TimelineBuilder

Loop enables looping

func (*TimelineBuilder) Then

func (tb *TimelineBuilder) Then(anim *Animation) *TimelineBuilder

Then adds an animation after the previous one

func (*TimelineBuilder) With

func (tb *TimelineBuilder) With(anim *Animation) *TimelineBuilder

With adds an animation alongside the previous one

type Vector2

type Vector2 struct {
	X, Y float64
}

Vector2 represents a 2D vector for position/movement animations

func (Vector2) Distance

func (v Vector2) Distance(other Vector2) float64

Distance calculates distance between two vectors

func (Vector2) Lerp

func (v Vector2) Lerp(target Vector2, t float64) Vector2

Lerp interpolates between two vectors

func (Vector2) Normalize

func (v Vector2) Normalize() Vector2

Normalize returns a normalized vector

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL