Exemple #1
0
        //protected AnimationTimer Timer = new AnimationTimer();

        public BeatGraphView(IntPtr handle) : base(handle)
        {
            // TODO: check that beat is graphable
            BeatLength = Metronome.Instance.GetQuartersForCompleteCycle();

            // attach the layer delegate
            AnimationLayer.Delegate = new GraphLayerDelegate()
            {
                BeatLength = BeatLength
            };

            Metronome.Instance.BeatChanged += Instance_BeatChanged;

            GraphingHelper.ResetElapsedBpm();
        }
Exemple #2
0
        public override void DrawFrame()//double bpm)
        {
            // determines duration of the blink effect
            CATransaction.AnimationDuration = .1;

            GraphingHelper.UpdateElapsedBpm();
            //double elapsedBpm = Timer.GetElapsedBpm();
            //lock (_ringLock)
            //{
            // progress the rings. Animate any blinking if needed.
            foreach (Ring ring in Rings)
            {
                ring.Progress();
            }
            //}

            AnimationLayer.SetNeedsDisplay();
        }
Exemple #3
0
        void Instance_BeatChanged(object sender, EventArgs e)
        {
            // update the beat length
            BeatLength = Metronome.Instance.GetQuartersForCompleteCycle();

            ((GraphLayerDelegate)AnimationLayer.Delegate).BeatLength = BeatLength;

            GraphingHelper.ResetElapsedBpm();

            var newRings = GraphingHelper.BuildGraph(Layer, BeatLength);

            // need to fast forward the new rings
            if (Metronome.Instance.PlayState != Metronome.PlayStates.Stopped)
            {
                foreach (Ring ring in newRings)
                {
                    ring.Progress();
                }
            }

            lock (_ringLock)
            {
                // replace old rings
                foreach (Ring ring in Rings)
                {
                    ring.Dispose();
                }

                Rings = newRings;
            }

            // display new rings
            foreach (Ring ring in Rings)
            {
                ring.SizeToSuperLayer();
                ring.DrawStaticElements();
            }
        }
Exemple #4
0
 protected override void CreateAssets()
 {
     // build the graph, get rings
     Rings = GraphingHelper.BuildGraph(Layer, BeatLength);
 }