AddChannel adds a channel to the animation.
(ch IChannel)
| 134 | |
| 135 | // AddChannel adds a channel to the animation. |
| 136 | func (anim *Animation) AddChannel(ch IChannel) { |
| 137 | |
| 138 | // TODO (maybe) prevent user from adding two channels of the same type that share target ? |
| 139 | |
| 140 | // Add the channel |
| 141 | anim.channels = append(anim.channels, ch) |
| 142 | |
| 143 | // Update maxTime and minTime values |
| 144 | kf := ch.Keyframes() |
| 145 | firstTime := kf[0] |
| 146 | if anim.minTime > firstTime { |
| 147 | anim.minTime = firstTime |
| 148 | } |
| 149 | lastTime := kf[len(kf)-1] |
| 150 | if anim.maxTime < lastTime { |
| 151 | anim.maxTime = lastTime |
| 152 | } |
| 153 | } |
no test coverage detected