Documentation

Overview

    Package animation

    Index

    Constants

    View Source
    const (
    	STEP        = InterpolationType("STEP")        // The animated values remain constant to the output of the first keyframe, until the next keyframe.
    	LINEAR      = InterpolationType("LINEAR")      // The animated values are linearly interpolated between keyframes. Spherical linear interpolation (slerp) is used to interpolate quaternions.
    	CUBICSPLINE = InterpolationType("CUBICSPLINE") // TODO
    )

      The various interpolation types.

      Variables

      This section is empty.

      Functions

      This section is empty.

      Types

      type Animation

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

        Animation is a keyframe animation, containing channels. Each channel animates a specific property of an object. Animations can span multiple objects and properties.

        func NewAnimation

        func NewAnimation() *Animation

          NewAnimation creates and returns a pointer to a new Animation object.

          func (*Animation) AddChannel

          func (anim *Animation) AddChannel(ch IChannel)

            AddChannel adds a channel to the animation.

            func (*Animation) Loop

            func (anim *Animation) Loop() bool

              Loop returns whether the animation is looping.

              func (*Animation) Name

              func (anim *Animation) Name() string

                Name returns the animation name.

                func (*Animation) Paused

                func (anim *Animation) Paused() bool

                  Paused returns whether the animation is paused.

                  func (*Animation) Reset

                  func (anim *Animation) Reset()

                    Reset resets the animation to the beginning.

                    func (*Animation) SetLoop

                    func (anim *Animation) SetLoop(state bool)

                      SetLoop sets whether the animation is looping.

                      func (*Animation) SetName

                      func (anim *Animation) SetName(name string)

                        SetName sets the animation name.

                        func (*Animation) SetPaused

                        func (anim *Animation) SetPaused(state bool)

                          SetPaused sets whether the animation is paused.

                          func (*Animation) SetSpeed

                          func (anim *Animation) SetSpeed(speed float32)

                            SetSpeed sets the animation speed.

                            func (*Animation) SetStart

                            func (anim *Animation) SetStart(v float32)

                              SetStart sets the initial time offset value.

                              func (*Animation) Speed

                              func (anim *Animation) Speed() float32

                                Speed returns the animation speed.

                                func (*Animation) Update

                                func (anim *Animation) Update(delta float32)

                                  Update interpolates and updates the target values for each channel. If the animation is paused, returns false. If the animation is not paused, returns true if the input value is inside the key frames ranges or false otherwise.

                                  type Channel

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

                                    A Channel associates an animation parameter channel to an interpolation sampler

                                    func (*Channel) InterpolationTangents

                                    func (c *Channel) InterpolationTangents() (inTangent, outTangent math32.ArrayF32)

                                      InterpolationTangents sets the interpolation tangents

                                      func (*Channel) InterpolationType

                                      func (c *Channel) InterpolationType() InterpolationType

                                        InterpolationType returns the current interpolation type.

                                        func (*Channel) Keyframes

                                        func (c *Channel) Keyframes() math32.ArrayF32

                                          Keyframes returns the keyframe buffer.

                                          func (*Channel) SetBuffers

                                          func (c *Channel) SetBuffers(keyframes, values math32.ArrayF32)

                                            SetBuffers sets the keyframe and value buffers.

                                            func (*Channel) SetInterpolationTangents

                                            func (c *Channel) SetInterpolationTangents(inTangent, outTangent math32.ArrayF32)

                                              SetInterpolationTangents sets the interpolation tangents.

                                              func (*Channel) SetInterpolationType

                                              func (c *Channel) SetInterpolationType(it InterpolationType)

                                                SetInterpolationType sets the interpolation type for this channel.

                                                func (*Channel) Update

                                                func (c *Channel) Update(time float32)

                                                  Update finds the keyframe preceding the specified time. Then, calls a stored function to interpolate the relevant values and update the target.

                                                  func (*Channel) Values

                                                  func (c *Channel) Values() math32.ArrayF32

                                                    Values returns the value buffer.

                                                    type IChannel

                                                    type IChannel interface {
                                                    	Update(time float32)
                                                    	SetBuffers(keyframes, values math32.ArrayF32)
                                                    	Keyframes() math32.ArrayF32
                                                    	Values() math32.ArrayF32
                                                    	SetInterpolationType(it InterpolationType)
                                                    }

                                                      IChannel is the interface for all channel types.

                                                      type InterpolationType

                                                      type InterpolationType string

                                                        InterpolationType specifies the interpolation type.

                                                        type MorphChannel

                                                        type MorphChannel struct {
                                                        	Channel
                                                        	// contains filtered or unexported fields
                                                        }

                                                          MorphChannel is the IChannel for morph geometries.

                                                          func NewMorphChannel

                                                          func NewMorphChannel(mg *geometry.MorphGeometry) *MorphChannel

                                                          type NodeChannel

                                                          type NodeChannel struct {
                                                          	Channel
                                                          	// contains filtered or unexported fields
                                                          }

                                                            NodeChannel is the IChannel for all node transforms.

                                                            type PositionChannel

                                                            type PositionChannel NodeChannel

                                                              PositionChannel is the animation channel for a node's position.

                                                              func NewPositionChannel

                                                              func NewPositionChannel(node core.INode) *PositionChannel

                                                              type RotationChannel

                                                              type RotationChannel NodeChannel

                                                                RotationChannel is the animation channel for a node's rotation.

                                                                func NewRotationChannel

                                                                func NewRotationChannel(node core.INode) *RotationChannel

                                                                type ScaleChannel

                                                                type ScaleChannel NodeChannel

                                                                  ScaleChannel is the animation channel for a node's scale.

                                                                  func NewScaleChannel

                                                                  func NewScaleChannel(node core.INode) *ScaleChannel