I am trying to create a simple animation of a sphere moving along a curve. I read here that this can be done using the CanUpdatePeriodically attribute. I am not sure how I should use it, however, so I would appreciate any help for a direction. Here is my initial attempt. It only runs once, so I suppose it needs more than that. Many thanks for your help.
[CanUpdatePeriodically(true)]
public static Sphere MoveAlongCurve(Curve curve, double speed)
{
double t = 0.0;
t += speed;
if(t > 1.0)
{
t = 1.0;
}
Point p = curve.PointAtParameter(t);
Sphere sphere = Sphere.ByCenterPointRadius(p, 1.0);
p.Dispose();
return sphere;
}
which has a method with CanUpdatePeriodically attribute, but similarly it does not seem to be updated, and only runs once. If I run it from DynamoSandbox (outside Revit), the method is completed immediately, but if run from Revit, the methods keeps running, but never visits the method twice.
You could try exporting a view as an image. If your script loops over say 100 different points moving the sphere to a different point each time then export the view after each movement using the ExportAsImage node. Then stitch the 100 images together.
Thanks a lot Vikram, this may be what I am looking for. As long as I can have a live animation system in Dynamo, I am happy. Just wondering if there is any way to perform a faster iteration (in milliseconds?).