c# - WPF camera animation issue -
i have 3d model in wpf , im trying make animation makes camera go around model. have following code:
public mainwindow() { initializecomponent(); registername("thiswindow", this); } private model3dgroup mainmodel3dgroup = new model3dgroup(); private perspectivecamera thecamera; private double cameraphi = math.pi / 6.0; private double cameratheta = math.pi / 6.0; private double camerar = 35.0; private storyboard storyboard = new storyboard(); private dependencyproperty cameraphiproperty = dependencyproperty.register("cameraphiproperty", typeof(double), typeof(mainwindow)); private void window_loaded(object sender, routedeventargs e) { // define model, lights , everthing animations(); } private void rotatearoundtower() { doubleanimation animation = new doubleanimation(); animation.from = 0.0; animation.to = 360.0; animation.duration = new duration(timespan.fromseconds(10)); animation.repeatbehavior = repeatbehavior.forever; storyboard.children.add(animation); storyboard.settargetname(animation, "thiswindow"); storyboard.settargetproperty(animation, new propertypath(cameraphiproperty)); } private void positioncamera() { // translates cameraphi , cameratheta coordinates , positions camera accordingly }
everything have of animation pieced found on msdn, seems me problem animation changes dependencyproperty cameraphiproperty object, , positioncamera never called. how can pass value dependencyproperty cameraphi , call positioncamera? or there cleaner solution animating this?
Comments
Post a Comment