mshvern23
Topic Author
Posts: 35
Joined: 22 May 2023, 02:00

Animating model properties

19 Jun 2023, 07:53

I have a CameraOffset value on my model. I can change it just fine using
<b:ChangePropertyAction TargetObject="{Binding}" PropertyName="CameraOffset" Value="300,100"/>
But a storyboard defined like this would not work
<PointAnimationUsingKeyFrames Storyboard.Target="{Binding}" Storyboard.TargetProperty="CameraOffset">
Is there a way to make storyboard animations for model properties?

I tried all sorts of variations, most result in something like this
LogNoesis: Error: Binding failed: Path=Self, Source=NoesisGUI.GameMapView(''), Target=PointAnimationUsingKeyFrames(''), TargetProperty=Storyboard.Target
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: Animating model properties

20 Jun 2023, 19:02

Yes, only dependency properties can be animated. So you can bind your model property to a UI element property with a TwoWay binding. Then you can animate the UI element property, and the animated value will be transferred to the model.

Could something like this work for you?
<Decorator x:Name="test" RenderTransformOrigin="{Binding CameraOffset, Mode=TwoWay}"/>
 
mshvern23
Topic Author
Posts: 35
Joined: 22 May 2023, 02:00

Re: Animating model properties

22 Jun 2023, 01:07

Thanks, I think this is a decent workaround to not have to declare a dependency property

Who is online

Users browsing this forum: No registered users and 5 guests