private void Contact_Click(object sender, RoutedEventArgs e) { DoubleAnimation animation1 = new DoubleAnimation(); animation1.From = 0; animation1.To = 0; animation1.Duration = new Duration(TimeSpan.FromMilliseconds(1)); TextBlockAbout.BeginAnimation(OpacityProperty, animation1); TextBlockAbout1.BeginAnimation(OpacityProperty, animation1); EllipseLoc.BeginAnimation(OpacityProperty, animation1); TextBlockLoc.BeginAnimation(OpacityProperty, animation1); RectangleLoc.BeginAnimation(OpacityProperty, animation1); TextBlockSearch.BeginAnimation(OpacityProperty, animation1); TextBlockSet.BeginAnimation(OpacityProperty, animation1); RectangleSet.BeginAnimation(OpacityProperty, animation1); buttonBlue.BeginAnimation(OpacityProperty, animation1); buttonGreen.BeginAnimation(OpacityProperty, animation1); buttonGrey.BeginAnimation(OpacityProperty, animation1); buttonRed.BeginAnimation(OpacityProperty, animation1); buttonStandard.BeginAnimation(OpacityProperty, animation1); buttonViolet.BeginAnimation(OpacityProperty, animation1); buttonYellow.BeginAnimation(OpacityProperty, animation1); DoubleAnimation animation = new DoubleAnimation(); animation.From = 0; animation.To = 1; animation.Duration = new Duration(TimeSpan.FromSeconds(2)); RectangleContact.BeginAnimation(OpacityProperty, animation); TextBlockContact.BeginAnimation(OpacityProperty, animation); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here level1 = Content.Load <RectangleSet>("level1"); pixel = Content.Load <Texture2D>("pixel"); particleTexture = Content.Load <Texture2D>("particle"); font = Content.Load <SpriteFont>("font"); background = Color.Black; square = Color.Aquamarine; gameOver = false; var r = new System.Random(); // mouse system mouseSystem = new ParticleSystem(this.GraphicsDevice, 1000, particleTexture); mouseSystem.SpawnPerFrame = 4; mouseSystem.SpawnParticle = (ref Particle particle) => { MouseState mouse = Mouse.GetState(); particle.Position = new Vector2(mouse.X, mouse.Y); particle.Velocity = new Vector2( MathHelper.Lerp(-50, 50, (float)r.NextDouble()), MathHelper.Lerp(0, 100, (float)r.NextDouble()) ); particle.Acceleration = 0.1f * new Vector2(0, (float)-r.NextDouble()); particle.Color = Color.Crimson; particle.Scale = 1f; particle.Life = 1.0f; }; mouseSystem.UpdateParticle = (float deltaT, ref Particle particle) => { particle.Velocity += deltaT * particle.Acceleration; particle.Position += deltaT * particle.Velocity; particle.Scale -= deltaT; particle.Life -= deltaT; }; // background system backgroundSystem = new ParticleSystem(this.GraphicsDevice, 500, pixel); backgroundSystem.SpawnPerFrame = 4; backgroundSystem.SpawnParticle = (ref Particle particle) => { particle.Position = new Vector2(r.Next(SCREEN_WIDTH + 100), 0); particle.Velocity = new Vector2(0, SCREEN_HEIGHT); particle.Acceleration = Vector2.Zero; particle.Color = Color.Green; particle.Scale = 5f; particle.Life = 150.0f; }; backgroundSystem.UpdateParticle = (float deltaT, ref Particle particle) => { particle.Position += deltaT / 2 * particle.Velocity; particle.Scale -= deltaT; particle.Life -= deltaT; }; // end system endSystem = new ParticleSystem(this.GraphicsDevice, 100000, particleTexture); endSystem.SpawnPerFrame = 4; endSystem.SpawnParticle = (ref Particle particle) => { particle.Position = new Vector2(SCREEN_WIDTH / 2 + 25, SCREEN_HEIGHT / 2 - 150); particle.Velocity = new Vector2( MathHelper.Lerp(-100, 100, (float)r.NextDouble()), MathHelper.Lerp(-100, 100, (float)r.NextDouble()) ); particle.Acceleration = 0.1f * new Vector2(0, (float)-r.NextDouble()); particle.Color = Color.Orange; particle.Scale = 3f; particle.Life = 500.0f; }; endSystem.UpdateParticle = (float deltaT, ref Particle particle) => { particle.Velocity += deltaT * particle.Acceleration; particle.Position += deltaT * particle.Velocity; particle.Scale -= deltaT; particle.Life -= deltaT; }; }