Exemplo n.º 1
0
        private void UpdateBubbleCursor(Point cursorPosition)
        {
            var    x       = Utils.DistancesBetweenPointAndBubbles(cursorPosition, this.bubbles);
            Bubble closest = x.First().Key;
            Bubble second  = x.ElementAt(1).Key;

            double containmentDistanceClosest = x.First().Value + closest.Radius;
            double intersectingDistanceSecond = x.ElementAt(1).Value - second.Radius;

            this.cursorTransform.ScaleX = 2 * Math.Min(containmentDistanceClosest, intersectingDistanceSecond);
            this.cursorTransform.ScaleY = this.cursorTransform.ScaleX;
        }
Exemplo n.º 2
0
        private void OnTimerTick(object sender, object e)
        {
            // make a bubble
            CreateBubble();

            // pop a bubble
            Bubble poppingBubble = this.bubbles.Where(b => b.IsDestroyed == false).First();

            poppingBubble.IsDestroyed = true;
            Storyboard popAnimation = poppingBubble.FadeAnimateBubble(0.9, 0);

            popAnimation.Completed += delegate
            {
                this.TargetContainer.Children.Remove(poppingBubble.Visual);
                this.bubbles.Remove(poppingBubble);
            };
            popAnimation.Begin();
        }