AnimationDeveloperSamples.MapLayerEffectsKeyframe.Interpolate C# (CSharp) Method

Interpolate() public method

public Interpolate ( IAGAnimationTrack pTrack, IAGAnimationContainer pContainer, object pObject, int propertyIndex, double time, IAGKeyframe pNextKeyframe, IAGKeyframe pPrevKeyframe, IAGKeyframe pAfterNextKeyframe ) : void
pTrack IAGAnimationTrack
pContainer IAGAnimationContainer
pObject object
propertyIndex int
time double
pNextKeyframe IAGKeyframe
pPrevKeyframe IAGKeyframe
pAfterNextKeyframe IAGKeyframe
return void
        public void Interpolate(IAGAnimationTrack pTrack, IAGAnimationContainer pContainer,
            object pObject, int propertyIndex, double time, IAGKeyframe pNextKeyframe,
            IAGKeyframe pPrevKeyframe, IAGKeyframe pAfterNextKeyframe)
        {
            if (time < TimeStamp || time > pNextKeyframe.TimeStamp)
                return;

            double timeFactor;
            timeFactor = (time - TimeStamp) / (pNextKeyframe.TimeStamp - TimeStamp); //ignoring pPrevKeyframe and pAfterNextKeyframe
            if (propertyIndex == 0) //interpolate brightness
            {
                short brightnessInterpolated;
                short brightnessStart;
                short brightnessEnd;
                brightnessStart = brightness;
                brightnessEnd = System.Convert.ToInt16(pNextKeyframe.get_PropertyValue(0));
                brightnessInterpolated = System.Convert.ToInt16(timeFactor * (brightnessEnd - brightnessStart) + brightnessStart);
                SetBrightness((ILayer)pObject, brightnessInterpolated);
                bObjectsNeedRefresh = true;
            }
            else //interpolate contrast
            {
                short contrastInterpolated;
                short contrastStart;
                short contrastEnd;
                contrastStart = contrast;
                contrastEnd = System.Convert.ToInt16(pNextKeyframe.get_PropertyValue(1));
                contrastInterpolated = System.Convert.ToInt16(timeFactor * (contrastEnd - contrastStart) + contrastStart);
                SetContrast((ILayer)pObject, contrastInterpolated);
                bObjectsNeedRefresh = true;
            }
            return;
        }