Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6323895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:36:17+00:00 2026-05-24T16:36:17+00:00

I am learning how to create animations with C#. so if I am animating

  • 0

I am learning how to create animations with C#. so if I am animating the margin of an object for example then I would use the following method to animate its margin:

test(someObject, FrameworkElement.MarginProperty);

/// <summary>
/// animate margin of an object
/// </summary>
/// <param name="target">what object do you whant to animate?</param>
/// <param name="property">what property do you want to animate</param>
public void test(DependencyObject target, DependencyProperty property)
{
    ThicknessAnimation animation = new ThicknessAnimation();
    animation.To = new Thickness(0,0,0,0);   // final value

    //animation.From = new Thickness(50,50,50,50);

    //make animation last 5 seconds
    animation.BeginTime = TimeSpan.FromSeconds(0);
    animation.Duration = TimeSpan.FromSeconds(5);

    // set the ease function
    BounceEase b = new BounceEase();
    animation.EasingFunction = b;

    //note that I would like to add an easeIn function

    //start animating
    Storyboard.SetTarget(animation, target);  // what object will be animated?
    Storyboard.SetTargetProperty(animation, new PropertyPath(property)); // what property will be animated
    Storyboard sb = new Storyboard();
    sb.Children.Add(animation);
    sb.Begin();
}

note that I am able to create a ease function. But what if I want to create an EaseInOut easing function. what do I have to add to my test method in order to animate the object using an EaseInOut approach.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T16:36:19+00:00Added an answer on May 24, 2026 at 4:36 pm

    I guess I finally got my method working in order to animate the margin of an object.

    MyStoryboards.Animations a = new MyStoryboards.Animations();
    
    // set the ease function
    BounceEase b = new BounceEase();
    b.Bounces = 5;
    b.Bounciness = 1;
    b.EasingMode = EasingMode.EaseIn;
    
    a.animThickness(tv, FrameworkElement.MarginProperty, tv.Margin, new Thickness(), TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(5), b);
    

    …

    …

    public void animThickness(DependencyObject target, DependencyProperty property, Thickness from, Thickness to, TimeSpan beginTime, TimeSpan duration , IEasingFunction e)
    {
        ThicknessAnimation animation = new ThicknessAnimation();
        animation.To = to;   // final value
    
        animation.From = from;
    
        animation.BeginTime = beginTime;
        animation.Duration = duration;
    
        animation.EasingFunction = e;
    
        //start animating
        Storyboard.SetTarget(animation, target);  // what object will be animated?
        Storyboard.SetTargetProperty(animation, new PropertyPath(property)); // what property will be animated
        Storyboard sb = new Storyboard();
        sb.Children.Add(animation);
        sb.Begin();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I start learning Silverlight and would like to create some simple game. I am
I am learning use VS 2008 setup project to create MSI installer for our
I've started learning Android development and am following a todolist example from a book:
I'm learning MVC and am having trouble deciding when I should create a new
I'm learning about table design in SQL and I'm wonder how to create a
Learning a little about T-SQL, and thought an interesting exercise would be to generate
For learning and demonstrating, I need a macro which prints its parameter and evaluates
I am currently learning to create custom controls in WPF. I successfully created a
I'm learning to create a WMS service using MapServer and after that I want
well im learning to create a wordpress plugin i downloaded one and read the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.