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

  • Home
  • SEARCH
  • 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 1036475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:42:36+00:00 2026-05-16T14:42:36+00:00

I start learning Silverlight and would like to create some simple game. I am

  • 0

I start learning Silverlight and would like to create some simple game.
I am using CompositionTarget.Rendering event for my animation

But animation is not smooth, I developed games before and I used double buffer to avoid such problems, but I can’t find if it possible with Silverlight.

Does anybody know how to create smooth animation with CompositionTarget.Rendering event.

Thanks,
.NET Developer.

  • 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-16T14:42:37+00:00Added an answer on May 16, 2026 at 2:42 pm

    Are you assuming that the Rendering event fires at a constant rate? It’s not guaranteed to. On my machine it usually fires 60 times per second, but sometimes it’s a bit faster and sometimes noticeably slower. It seems to skip a frame on occasion, which could cause your animation not to be smooth.

    However, the event gives you the information to determine exactly how long it’s been since the last frame (though you have to know how to get it), and you can code your animation to take this into account. Move farther if it’s been a longer amount of time since the last frame, etc.

    You need to take the EventArgs that’s passed to your event handler, cast it to RenderingEventArgs, and then read its RenderingTime property. Calculate the delta in RenderingTime since your last event; that tells you how long it’s been since your last frame was shown, and you can use that to pace your animations.

    CompositionTarget.Rendering += CompositionTarget_Rendering;
    
    ...
    
    private static TimeSpan? _lastRenderTime;
    private void CompositionTarget_Rendering(object sender, EventArgs e) {
        var args = (RenderingEventArgs) e;
        var elapsed = _lastRenderTime.HasValue ?
                          args.RenderingTime - _lastRenderTime.Value :
                          TimeSpan.Empty;
        _lastRenderTime = args.RenderingTime;
    
        // "elapsed" tells you how long since the last frame.
        // Now you can update your animation accordingly. For example,
        var left = Canvas.GetLeft(_myControl);
        left += elapsed.TotalSeconds * 100;
        Canvas.SetLeft(_myControl, left);
    }
    

    I’ve heard that, at least in WPF, RenderTime doesn’t tell you the current time, but rather what time it will be when the frame is shown on the screen. I haven’t seen that substantiated from official sources, and even if it’s true, I don’t know if it’s true for Silverlight as well. But whatever the case, it will give you the best possible information for writing your animation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to start learning reverse engineering. So I decided to start simple.
i start learning jquery few days ago, and i like it very much. but
I was about to start learning x64 assembly using this tutorial (series) but setting
I start learning some java concurrency concept ans put in use. But one of
What would you recommend to start learning and applying BDD on a casual game
Would some one suggest me the best method to start learning the fundas of
I'm about to start learning Ruby and would like a bit of reading material
I would like to start learning ASP.NET on a for-fun project. I'm hoping to
I would like to start learning SQL Server 2005 on my own. Can anyone
I'm in the process of learning Silverlight in the browser, and would like to

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.