Update interpolates the specified input value for each animation target channel and executes its corresponding action function. Returns true if the input value is inside the key frames ranges or false otherwise.
(delta float32)
| 67 | // and executes its corresponding action function. Returns true if the input value |
| 68 | // is inside the key frames ranges or false otherwise. |
| 69 | func (at *AnimationTarget) Update(delta float32) bool { |
| 70 | |
| 71 | // Checks if input is less than minimum |
| 72 | at.last = at.last + delta |
| 73 | if at.last < at.minInput { |
| 74 | return false |
| 75 | } |
| 76 | |
| 77 | // Checks if input is greater than maximum |
| 78 | if at.last > at.maxInput { |
| 79 | if at.loop { |
| 80 | at.Reset() |
| 81 | } else { |
| 82 | return false |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | for i := 0; i < len(at.channels); i++ { |
| 87 | ch := at.channels[i] |
| 88 | // Get interpolated value |
| 89 | v, ok := ch.sampler.Interpolate(at.last) |
| 90 | if !ok { |
| 91 | return false |
| 92 | } |
| 93 | // Call action func |
| 94 | ch.action(at, v) |
| 95 | // Sets final rotation |
| 96 | at.target.GetNode().SetRotation(at.rot.X, at.rot.Y, at.rot.Z) |
| 97 | } |
| 98 | return true |
| 99 | } |
| 100 | |
| 101 | // NewAnimationTargets creates and returns a map of all animation targets |
| 102 | // contained in the decoded Collada document and for the previously decoded scene. |
nothing calls this directly
no test coverage detected