mber.isRequired, simulateAnimation: PropTypes.func.isRequired, totalDuration: PropTypes.number.isRequired, }; } render() { const { animation, durationPerPixel, keyframes, offset, simulateAnimation, totalDuration, } = this.props; const { state } = animation; const effectTiming = Object.assign({}, state, { fill: "both", iterations: state.iterationCount ? state.iterationCount : Infinity, }); // Create new keyframes for opacity as computed style. // The reason why we use computed value instead of computed timing progress is to // include the easing in keyframes as well. Although the computed timing progress // is not affected by the easing in keyframes at all, computed value reflects that. const frames = keyframes.map(keyframe => { return { opacity: keyframe.offset, offset: keyframe.offset, easing: keyframe.easing, }; }); const simulatedAnimation = simulateAnimation(frames, effectTiming, true); if (!simulatedAnimation) { return null; } const simulatedElement = simulatedAnimation.effect.target; const win = simulatedElement.ownerGlobal; const endTime = simulatedAnimation.effect.getComputedTiming().endTime; // Set the underlying opacity to zero so that if we sample the animation's output // during the delay phase and it is not filling backwards, we get zero. simulatedElement.style.opacity = 0; const getValueFunc = time => { simulatedAnimation.currentTime = time; return win.getComputedStyle(simulatedElement).opacity; }; const toPathStringFunc = createSummaryGraphPathStringFunction( endTime, state.playbackRate ); const helper = new SummaryGraphHelper( state, keyframes, totalDuration, durationPerPixel, getValueFunc, toPathStringFunc ); return dom.g( { className: this.getClassName(), transform: `translate(${offset})`, }, this.renderGraph(state, helper) ); } } module.exports = NegativePath; PK