none
Animating a horizontal line vertically, flickering?

    Question

  • Anyone know why the line in the following code flickers?

    <Canvas x:Name="LayoutRoot" Background="White" UseLayoutRounding="False">
            <Canvas.Triggers>
                <EventTrigger RoutedEvent="Canvas.Loaded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard x:Name="animation"
                  Storyboard.TargetName="horizontal"
                  Storyboard.TargetProperty="(Canvas.Top)" RepeatBehavior="Forever">
                                <DoubleAnimation To="400" Duration="0:0:01" />
                                
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </Canvas.Triggers>
    
            <Line x:Name="horizontal" X1="1" Y1="1" X2="300" Y2="1" Stroke="#000000" StrokeThickness="2"/>
            
        </Canvas>


    Tuesday, December 04, 2012 3:11 PM

Answers

  • but if you change the SpeedRation of storyboard and try to set 0.1 or 0.2 then it works fine or if u inrease the duration.


    Best Regards, Naveen Goyal

    • Marked as answer by iwpfModerator Wednesday, December 12, 2012 12:48 PM
    Monday, December 10, 2012 1:16 PM
  • Hi,

    You have set this animation very fast, so the line will flicker

    please try slow a little bit, like:

     Duration="0:0:10
    Best Regards


    Mark Yu - MSFT
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by iwpfModerator Wednesday, December 12, 2012 12:48 PM
    Monday, December 10, 2012 3:09 PM
    Moderator

All replies

  • but if you change the SpeedRation of storyboard and try to set 0.1 or 0.2 then it works fine or if u inrease the duration.


    Best Regards, Naveen Goyal

    • Marked as answer by iwpfModerator Wednesday, December 12, 2012 12:48 PM
    Monday, December 10, 2012 1:16 PM
  • Hi,

    You have set this animation very fast, so the line will flicker

    please try slow a little bit, like:

     Duration="0:0:10
    Best Regards


    Mark Yu - MSFT
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by iwpfModerator Wednesday, December 12, 2012 12:48 PM
    Monday, December 10, 2012 3:09 PM
    Moderator
  • The behavior seems erroneous to me, as a similarly speedy horizontal line does not flicker in this respect. It seems almost like the invalidated regions are sometimes "missing" the vertically moving line.
    Thursday, January 10, 2013 10:19 PM
  • also, WPF does not flicker in a similar circumstance. Leads me to believe there may be an issue in the SL rasterizer.
    Thursday, January 10, 2013 10:21 PM
  • A similarly speedy horizontally animated vertical line, I mean.
    Thursday, January 10, 2013 10:22 PM
  • Actually horizontal does the same, it seems, I thought it remembered differently.

    But please, run that same code in WPF, and see that it does not flicker, so why does Silverlight behave any differently please?

    -Graham

    Thursday, January 10, 2013 10:36 PM
  • WPF is completely run on machine and has full access to machine resources like hardware usage (Graphic card etc) on the other hand Silverlight has limited access so could not utilize machine's power (resources).

    Best Regards, Naveen Goyal

    • Proposed as answer by Naveen Goyal Friday, January 11, 2013 12:46 PM
    Friday, January 11, 2013 10:46 AM
  • Naveen,

    That shouldn't mean that the line just vanishes seemingly at random. The effect is pretty disconcerting. Oftentimes when rendering polylines Silverlight can be a great deal faster as the polyline tessellation pipeline in WPF seems to tank pretty hard on certain line shapes (lots of Y noise), compared to SL's multicore software rasterization.

    This seems to me more like a timing bug in the redraw regions in Silverlight, but its hard to tell from the outside. All I know is that it makes animating a horizontal line feel kind of useless if it needs to move quickly at all. Maybe I'd be better off rasterizing it myself using WritableBitmap??

    Friday, January 11, 2013 8:18 PM