Documentation ¶
Index ¶
- Variables
- func BindAngle(angle float64) float64
- func Clamp(value, min, max float64) float64
- func DeltaAngle(current, target float64) float64
- func EaseInBack(t float64) float64
- func EaseInBounce(t float64) float64
- func EaseInCirc(t float64) float64
- func EaseInCubic(t float64) float64
- func EaseInElastic(t float64) float64
- func EaseInExpo(t float64) float64
- func EaseInOutBack(t float64) float64
- func EaseInOutBounce(t float64) float64
- func EaseInOutCirc(t float64) float64
- func EaseInOutCubic(t float64) float64
- func EaseInOutElastic(t float64) float64
- func EaseInOutExpo(t float64) float64
- func EaseInOutQuad(t float64) float64
- func EaseInOutQuart(t float64) float64
- func EaseInOutQuint(t float64) float64
- func EaseInOutSine(t float64) float64
- func EaseInQuad(t float64) float64
- func EaseInQuart(t float64) float64
- func EaseInQuint(t float64) float64
- func EaseInSine(t float64) float64
- func EaseLinear(t float64) float64
- func EaseOutBack(t float64) float64
- func EaseOutBounce(t float64) float64
- func EaseOutCirc(t float64) float64
- func EaseOutCubic(t float64) float64
- func EaseOutElastic(t float64) float64
- func EaseOutExpo(t float64) float64
- func EaseOutQuad(t float64) float64
- func EaseOutQuart(t float64) float64
- func EaseOutQuint(t float64) float64
- func EaseOutSine(t float64) float64
- func Lerp(start, end, percent float64) float64
- func MoveTowards(current, target, maxDelta float64) float64
- func Repeat(value, length float64) float64
- func RotateTowards(current, target, maxDelta float64) float64
- func Sign(value float64) float64
- type Bounds
- type EaseFunc
- type GameTime
- type Ticker
- type TickerImp
- type Timer
- type TimerCompleteFunc
- type TimerOption
- type TimerRepeatMode
- type Transform
- func (t *Transform) Anchor() Vec2
- func (t *Transform) Bounds() Bounds
- func (t *Transform) Clean()
- func (t *Transform) GeoM() ebiten.GeoM
- func (t *Transform) Height() float64
- func (t *Transform) IsDirty() bool
- func (t *Transform) NaturalHeight() float64
- func (t *Transform) NaturalSize() (float64, float64)
- func (t *Transform) NaturalWidth() float64
- func (t *Transform) Position() Vec2
- func (t *Transform) ResetScale()
- func (t *Transform) Rotation() float64
- func (t *Transform) SetAnchor(anchor Vec2)
- func (t *Transform) SetHeight(height float64)
- func (t *Transform) SetNaturalHeight(naturalHeight float64)
- func (t *Transform) SetNaturalWidth(naturalWidth float64)
- func (t *Transform) SetPosition(pos Vec2)
- func (t *Transform) SetRotation(rotation float64)
- func (t *Transform) SetSize(width, height float64)
- func (t *Transform) SetWidth(width float64)
- func (t *Transform) SetX(x float64)
- func (t *Transform) SetY(y float64)
- func (t *Transform) Size() (float64, float64)
- func (t *Transform) Translate(delta Vec2)
- func (t *Transform) TranslateX(x float64)
- func (t *Transform) TranslateY(y float64)
- func (t *Transform) Width() float64
- func (t *Transform) X() float64
- func (t *Transform) Y() float64
- type TransformOption
- func TransformAtPosition(position Vec2) TransformOption
- func TransformAtXY(x, y float64) TransformOption
- func TransformWithAnchor(anchor Vec2) TransformOption
- func TransformWithFixedOffset(offset float64) TransformOption
- func TransformWithHeight(height float64) TransformOption
- func TransformWithNaturalHeight(naturalHeight float64) TransformOption
- func TransformWithNaturalSize(naturalWidth, naturalHeight float64) TransformOption
- func TransformWithNaturalWidth(naturalWidth float64) TransformOption
- func TransformWithRotation(rotation float64) TransformOption
- func TransformWithSize(width, height float64) TransformOption
- func TransformWithWidth(width float64) TransformOption
- type Tween
- func NewPositionTween(target *Transform, start, end Vec2, duration float64, useRelative bool, ...) *Tween
- func NewRotationTween(target *Transform, start, end, duration float64, useRelative bool, ...) *Tween
- func NewTween(duration float64, options ...TweenOption) *Tween
- func NewWidthTween(target *Transform, start, end float64, duration float64, ...) *Tween
- type TweenOption
- func TweenOnComplete(fn TweenStatusChangedFunc) TweenOption
- func TweenOnStart(fn TweenStatusChangedFunc) TweenOption
- func TweenPlay() TweenOption
- func TweenUpdateFunc(fn TweenValueFunc) TweenOption
- func TweenUpdatePointer(value *float64) TweenOption
- func TweenWithEase(easeFunc EaseFunc) TweenOption
- func TweenWithRepeat(mode TweenRepeatMode) TweenOption
- type TweenRepeatMode
- type TweenStatusChangedFunc
- type TweenValueFunc
- type Vec2
- func (v Vec2) Add(other Vec2) Vec2
- func (v Vec2) AddScalar(scalar float64) Vec2
- func (v Vec2) Angle() float64
- func (v Vec2) Cross(other Vec2) float64
- func (v Vec2) Dist(other Vec2) float64
- func (v Vec2) Div(other Vec2) Vec2
- func (v Vec2) DivScalar(scalar float64) Vec2
- func (v Vec2) Dot(other Vec2) float64
- func (v Vec2) Mag() float64
- func (v Vec2) Map(fun func(float64) float64) Vec2
- func (v Vec2) Mul(other Vec2) Vec2
- func (v Vec2) MulScalar(scalar float64) Vec2
- func (v Vec2) Normal() Vec2
- func (v Vec2) SqrDist(other Vec2) float64
- func (v Vec2) SqrMag() float64
- func (v *Vec2) String() string
- func (v Vec2) Sub(other Vec2) Vec2
- func (v Vec2) SubScalar(scalar float64) Vec2
- func (v Vec2) ToPoint() image.Point
- func (v Vec2) Unit() Vec2
- func (v Vec2) XY() (float64, float64)
Constants ¶
This section is empty.
Variables ¶
var ( AnchorTopLeft = Vec2{X: 0, Y: 0} AnchorTopCenter = Vec2{X: 0.5, Y: 0} AnchorTopRight = Vec2{X: 1, Y: 0} AnchorMiddleLeft = Vec2{X: 0, Y: 0.5} AnchorMiddleCenter = Vec2{X: 0.5, Y: 0.5} AnchorMiddleRight = Vec2{X: 1, Y: 0.5} AnchorBottomLeft = Vec2{X: 0, Y: 1} AnchorBottomCenter = Vec2{X: 0.5, Y: 1} AnchorBottomRight = Vec2{X: 1, Y: 1} )
9 standard anchors
var ( // Vec2Zero is a Vec2 of (0, 0) Vec2Zero = Vec2{0, 0} // Vec2One is a Vec2 of (1, 1) Vec2One = Vec2{1, 1} )
Functions ¶
func DeltaAngle ¶
func EaseInBack ¶
func EaseInBounce ¶
func EaseInCirc ¶
func EaseInCubic ¶
func EaseInElastic ¶
func EaseInExpo ¶
func EaseInOutBack ¶
func EaseInOutBounce ¶
func EaseInOutCirc ¶
func EaseInOutCubic ¶
func EaseInOutElastic ¶
func EaseInOutExpo ¶
func EaseInOutQuad ¶
func EaseInOutQuart ¶
func EaseInOutQuint ¶
func EaseInOutSine ¶
func EaseInQuad ¶
func EaseInQuart ¶
func EaseInQuint ¶
func EaseInSine ¶
func EaseLinear ¶
func EaseOutBack ¶
func EaseOutBounce ¶
func EaseOutCirc ¶
func EaseOutCubic ¶
func EaseOutElastic ¶
func EaseOutExpo ¶
func EaseOutQuad ¶
func EaseOutQuart ¶
func EaseOutQuint ¶
func EaseOutSine ¶
func MoveTowards ¶
func RotateTowards ¶
RotateTowards calculates the angle going from current to target not exceeding max delta and respecting the jump from +pi to -pi. All angles are in radians.
Types ¶
type Bounds ¶
func NewBoundsWidthHeight ¶
func (Bounds) Inside ¶ added in v0.3.0
Inside returns true if our bounds is entirely inside the other bounds
type GameTime ¶
type GameTime struct {
// contains filtered or unexported fields
}
func NewGameTime ¶
func NewGameTime() *GameTime
func (*GameTime) TotalDuration ¶
func (*GameTime) TotalSeconds ¶
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
func NewTimer ¶
func NewTimer(duration float64, options ...TimerOption) *Timer
func (*Timer) IsComplete ¶
type TimerCompleteFunc ¶
type TimerCompleteFunc func()
type TimerOption ¶
type TimerOption func(timer *Timer)
func TimerOnComplete ¶
func TimerOnComplete(fn TimerCompleteFunc) TimerOption
func TimerPlay ¶ added in v0.3.0
func TimerPlay() TimerOption
func TimerWithRepeat ¶
func TimerWithRepeat(mode TimerRepeatMode) TimerOption
type TimerRepeatMode ¶
type TimerRepeatMode string
const ( TimerNoRepeat TimerRepeatMode = "NoRepeat" TimerRepeats TimerRepeatMode = "Repeats" )
type Transform ¶
type Transform struct {
// contains filtered or unexported fields
}
Transform holds all data associated to a location
func NewTransform ¶
func NewTransform(options ...TransformOption) *Transform
NewTransform will create a new transform with: * position at 0,0, * rotation of 0 degress * anchor at top left * width, height, natural width and natural height are all 0 * you will have to set these before the first build Note that transforms start dirty.
func (*Transform) Bounds ¶ added in v0.3.0
Bounds of our transform NOTE: does not take into account rotation yet...
func (*Transform) Clean ¶
func (t *Transform) Clean()
Clean will clean up the dirty status back to false
func (*Transform) NaturalHeight ¶ added in v0.3.0
func (*Transform) NaturalSize ¶ added in v0.3.0
func (*Transform) NaturalWidth ¶ added in v0.3.0
func (*Transform) ResetScale ¶ added in v0.3.0
func (t *Transform) ResetScale()
ResetScale will set the width and height values to match the natural width and height values.
func (*Transform) SetNaturalHeight ¶ added in v0.3.0
SetNaturalHeight will set the natural height
func (*Transform) SetNaturalWidth ¶ added in v0.3.0
SetNaturalWidth will set the natural width
func (*Transform) SetPosition ¶
SetPosition will set our position to a different one
func (*Transform) SetRotation ¶
SetRotation will change the rotation value and mark us as dirty.
func (*Transform) TranslateX ¶
TranslateX moves us in the X axis
func (*Transform) TranslateY ¶
TranslateY moves us in the Y axis
type TransformOption ¶ added in v0.3.0
type TransformOption func(t *Transform)
func TransformAtPosition ¶ added in v0.3.0
func TransformAtPosition(position Vec2) TransformOption
func TransformAtXY ¶ added in v0.3.0
func TransformAtXY(x, y float64) TransformOption
func TransformWithAnchor ¶ added in v0.3.0
func TransformWithAnchor(anchor Vec2) TransformOption
func TransformWithFixedOffset ¶ added in v0.3.0
func TransformWithFixedOffset(offset float64) TransformOption
func TransformWithHeight ¶ added in v0.3.0
func TransformWithHeight(height float64) TransformOption
func TransformWithNaturalHeight ¶ added in v0.3.0
func TransformWithNaturalHeight(naturalHeight float64) TransformOption
TransformWithNaturalHeight will set the transform natural height value this will also override the current height to match
func TransformWithNaturalSize ¶ added in v0.3.0
func TransformWithNaturalSize(naturalWidth, naturalHeight float64) TransformOption
func TransformWithNaturalWidth ¶ added in v0.3.0
func TransformWithNaturalWidth(naturalWidth float64) TransformOption
TransformWithNaturalWidth will set the transform natural width value this will also override the current height to match
func TransformWithRotation ¶ added in v0.3.0
func TransformWithRotation(rotation float64) TransformOption
func TransformWithSize ¶ added in v0.3.0
func TransformWithSize(width, height float64) TransformOption
func TransformWithWidth ¶ added in v0.3.0
func TransformWithWidth(width float64) TransformOption
type Tween ¶
type Tween struct {
// contains filtered or unexported fields
}
func NewPositionTween ¶ added in v0.3.0
func NewRotationTween ¶ added in v0.3.0
func NewRotationTween( target *Transform, start, end, duration float64, useRelative bool, options ...TweenOption, ) *Tween
func NewTween ¶
func NewTween(duration float64, options ...TweenOption) *Tween
func NewWidthTween ¶ added in v0.3.0
func NewWidthTween( target *Transform, start, end float64, duration float64, options ...TweenOption, ) *Tween
func (*Tween) Bounce ¶ added in v0.3.0
func (t *Tween) Bounce()
Bounce will start the tween bouncing back if the tween was not yet complete
func (*Tween) IsComplete ¶
type TweenOption ¶
type TweenOption func(t *Tween)
func TweenOnComplete ¶
func TweenOnComplete(fn TweenStatusChangedFunc) TweenOption
func TweenOnStart ¶
func TweenOnStart(fn TweenStatusChangedFunc) TweenOption
func TweenPlay ¶ added in v0.3.0
func TweenPlay() TweenOption
func TweenUpdateFunc ¶
func TweenUpdateFunc(fn TweenValueFunc) TweenOption
func TweenUpdatePointer ¶
func TweenUpdatePointer(value *float64) TweenOption
func TweenWithEase ¶
func TweenWithEase(easeFunc EaseFunc) TweenOption
func TweenWithRepeat ¶
func TweenWithRepeat(mode TweenRepeatMode) TweenOption
type TweenRepeatMode ¶
type TweenRepeatMode string
const ( // Does not repeat, will trigger complete and be removed from ticker TweenNoRepeat TweenRepeatMode = "NoRepeat" // Repeats the tween from the start over and over again TweenRepeatLoop TweenRepeatMode = "Loop" // Bounces the tween going from 0>1>0 in a loop, reversing the ease to get a good bounce TweenRepeatBounceLoop TweenRepeatMode = "RepeatBounce" // Bounces the tween going from 0>1>0, reversing the ease to get a good bounce TweenRepeatBounce TweenRepeatMode = "Bounce" // Pauses the tween at the end ready to start again TweenRepeatPause TweenRepeatMode = "Pause" )
type TweenStatusChangedFunc ¶
type TweenStatusChangedFunc func(tween *Tween)
type TweenValueFunc ¶
type TweenValueFunc func(value float64)
func TweenVec2Func ¶
func TweenVec2Func(start, end Vec2, fn func(Vec2)) TweenValueFunc
func TweenVec2Pointer ¶
func TweenVec2Pointer(start, end Vec2, ptr *Vec2) TweenValueFunc
type Vec2 ¶
type Vec2 struct {
X, Y float64
}
Vec2 describes a 2D vector or point in floats
func Vec2FromAngle ¶
Vec2FromAngle returns a Vec2 from an angle in radians
func Vec2FromInts ¶ added in v0.3.0
Vec2FromInts returns a Vec2 from an image point
func Vec2FromPoint ¶
Vec2FromPoint returns a Vec2 from an image point
func (Vec2) Map ¶
Map applies a function to both X and Y components and returns a new Vec2 of the result