Hi I am trying to programmatically control a WPF animation but am getting the error above, could someone help with the error – not very familiar with c# – thanks
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;
namespace WpfApplication10
{
///
/// Interaction logic for Window1.xaml
///
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
AnimationClock clock;
void StartAnimation()
{
DoubleAnimation animate = new DoubleAnimation();
animate.To = 300;
animate.Duration = new Duration(TimeSpan.FromSeconds(5));
animate.RepeatBehavior = RepeatBehavior.Forever;
clock = animate.CreateClock();
test.ApplyAnimationClock(Ellipse.WidthProperty, clock);
}
void PauseAnimation()
{
clock = new AnimationClock();
clock.Controller.Pause();
}
void ResumeAnimation()
{
clock.Controller.Resume();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
PauseAnimation();
}
}
}
Similar:
- Programatically WPF Fade In (via extension methods) I’m trying to write a simple (stand alone) C# extension method to do a Fade-In of a generic WPF UIElement, but the solutions (and code...
- WPF animation problem when using Storyboard from code I’m working on a 3D carousel of flat, square tiles that will contain information. I’m working on animating this carousel to rotate when a person...
- Is there a way to do rotation in UIViewController without animation? Is there a way to enable rotation but without the animation as you turn the device from portrait to landscape? I’m looking at: - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation...
- WPF Animation – Animating Bezier curve points I’m working on a project that involves drawing curved paths between two objects. Currently, I’ve been writing some test code to play around with bezier...
- Android Animation one after other I have two TranslateAnimation on a TextView and i want them to execute one after other.. but using the below code, only the second one...
Tags: clock controller, collections, duration, interaction, logic, media animation, shapes, system windows, windows media