How to make an ellipse follow a curve on a canvas

后端 未结 2 1529
太阳男子
太阳男子 2021-01-15 04:53

I am having an issue trying to get an ellipse to properly follow a path on my canvas. I supposed the problem stems from the fact that my mini syntax defines movement between

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-15 05:02

    Instead of simultaneously animating Canvas.Left and Canvas.Top you may perhaps also animate the Matrix property of a MatrixTransform that is assigned to the RenderTransform property of the Ellipse. The Matrix would be animated by a MatrixAnimationUsingPath.

    
        
            
        
        
            
                
                    
                        
                            
                                
                            
                        
                    
                
            
        
    
    

    Using a MatrixAnimationUsingPath would even allow to rotate the animated element along the tangent of the animation path, by setting DoesRotateWithTangent="True". That would of course only be visible if the animated element wouldn't be a circle.

提交回复
热议问题