コード例 #1
0
ファイル: GUIAnimation.cs プロジェクト: weimingtom/OtterUI
        /// <summary>
        /// Creates a keyframe at the specified frame for the control.
        /// TODO : Move the logic to insert keyframes into a keyframe collection list!
        /// </summary>
        /// <param name="control"></param>
        /// <param name="frame"></param>
        public void CreateKeyFrame(GUIControl control, KeyFrame keyFrame)
        {
            GUIAnimationChannel animation = GetAnimationChannel(control);

            if (animation == null)
            {
                animation         = new GUIAnimationChannel();
                animation.Control = control;
                mAnimationChannels.Add(animation);

                NotifyAnimationChannelAdded(animation);
            }

            int numKeyFrames = animation.KeyFrames.Count;

            for (int i = 0; i < numKeyFrames; i++)
            {
                if (animation.KeyFrames[i].Frame == keyFrame.Frame)
                {
                    animation.KeyFrames[i] = keyFrame;
                    return;
                }
            }

            // If we got here, the frame wasn't found, so just add it and sort
            animation.KeyFrames.Add(keyFrame);
            animation.KeyFrames.Sort((a, b) => ((int)a.Frame - (int)b.Frame));

            NotifyKeyframeAdded();
        }
コード例 #2
0
ファイル: GUIAnimation.cs プロジェクト: weimingtom/OtterUI
 /// <summary>
 /// Notifies that a channel channel has been removed from this set
 /// </summary>
 private void NotifyAnimationChannelRemoved(GUIAnimationChannel animation)
 {
     if (AnimationChannelRemoved != null)
     {
         AnimationChannelRemoved(this, animation);
     }
 }
コード例 #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="frames"></param>
 /// <param name="animation"></param>
 public ClearFramesCommand(GUIAnimation animation, GUIAnimationChannel animationChannel, int start, int end)
 {
     mAnimation = animation;
     mAnimationChannel = animationChannel;
     mStart = start;
     mEnd = end;
     mKeyFrames = new List<KeyFrame>();
 }
コード例 #4
0
        /// <summary>
        /// Clones this channel in its entirety
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            GUIAnimationChannel channel = new GUIAnimationChannel();

            channel.mControlID = this.mControlID;

            foreach(KeyFrame keyFrame in this.mKeyFrames)
                channel.mKeyFrames.Add((KeyFrame)keyFrame.Clone());

            return channel;
        }
コード例 #5
0
        /// <summary>
        /// Clones this channel in its entirety
        /// </summary>
        /// <returns></returns>
        public object Clone()
        {
            GUIAnimationChannel channel = new GUIAnimationChannel();

            channel.mControlID = this.mControlID;

            foreach (KeyFrame keyFrame in this.mKeyFrames)
            {
                channel.mKeyFrames.Add((KeyFrame)keyFrame.Clone());
            }

            return(channel);
        }
コード例 #6
0
ファイル: TimelineControl.cs プロジェクト: RasterCode/OtterUI
 /// <summary>
 /// Called when an channel has been added to an channel set
 /// </summary> 
 /// <param name="sender"></param>
 /// <param name="channel"></param>
 void GUIAnimation_AnimationChannelAdded(object sender, GUIAnimationChannel animation)
 {
     mChannels = GetChannelList();
     this.Invalidate(true);
 }