* @param {!./service/vsync-impl.Vsync} vsync * @param {!Node} contextNode * @param {!Array<!SegmentDef>} segments * @param {?./core/data-structures/curve.CurveDef} defaultCurve * @param {!TimestampDef} duration
(vsync, contextNode, segments, defaultCurve, duration)
| 133 | * @param {!TimestampDef} duration |
| 134 | */ |
| 135 | constructor(vsync, contextNode, segments, defaultCurve, duration) { |
| 136 | /** @private @const {!./service/vsync-impl.Vsync} */ |
| 137 | this.vsync_ = vsync; |
| 138 | |
| 139 | /** @private @const {!Node} */ |
| 140 | this.contextNode_ = contextNode; |
| 141 | |
| 142 | /** @private @const {!Array<!SegmentRuntimeDef>} */ |
| 143 | this.segments_ = []; |
| 144 | for (let i = 0; i < segments.length; i++) { |
| 145 | const segment = segments[i]; |
| 146 | this.segments_.push({ |
| 147 | delay: segment.delay, |
| 148 | func: segment.func, |
| 149 | duration: segment.duration, |
| 150 | curve: segment.curve || defaultCurve, |
| 151 | started: false, |
| 152 | completed: false, |
| 153 | }); |
| 154 | } |
| 155 | |
| 156 | /** @private @const */ |
| 157 | this.duration_ = duration; |
| 158 | |
| 159 | /** @private {!TimestampDef} */ |
| 160 | this.startTime_ = Date.now(); |
| 161 | |
| 162 | /** @private {!NormTimeDef} */ |
| 163 | // this.normLinearTime_ = 0; |
| 164 | |
| 165 | /** @private {!NormTimeDef} */ |
| 166 | // this.normTime_ = 0; |
| 167 | |
| 168 | /** @private {boolean} */ |
| 169 | this.running_ = true; |
| 170 | |
| 171 | /** @private {!{[key: string]: *}} */ |
| 172 | this.state_ = {}; |
| 173 | |
| 174 | const deferred = new Deferred(); |
| 175 | |
| 176 | /** @const @private */ |
| 177 | this.promise_ = deferred.promise; |
| 178 | |
| 179 | /** @const @private */ |
| 180 | this.resolve_ = deferred.resolve; |
| 181 | |
| 182 | /** @const @private */ |
| 183 | this.reject_ = deferred.reject; |
| 184 | |
| 185 | /** @const */ |
| 186 | this.task_ = this.vsync_.createAnimTask(this.contextNode_, { |
| 187 | mutate: this.stepMutate_.bind(this), |
| 188 | }); |
| 189 | |
| 190 | if (this.vsync_.canAnimate(this.contextNode_)) { |
| 191 | this.task_(this.state_); |
| 192 | } else { |
nothing calls this directly
no test coverage detected