Quick Question: Is there a way to export a bezier-curve (or motion path) into a list of x,y - coordinates?
There is not a built-in way to export this data, but you could get it with some javascript. Let’s say you gave an element a unique element ID “mybox” and had it animate with one motion path on the Main Timeline. You could make an On Scene Load handler run this javascript:
// setup capture values
var startTime = 0.0;
var endTime = hypeDocument.durationForTimelineNamed("Main Timeline");
var framesPerSecond = 30.0;
// element we're interested in
var boxElement = hypeDocument.getElementById("mybox");
// eventual array position data will be stored in
var positions = [];
// loop through, advancing by a frame
for(var time = startTime; time < endTime; time += (1.0/framesPerSecond)) {
// set the document to be at the frame time
hypeDocument.goToTimeInTimelineNamed(time, "Main Timeline");
// capture the x/y position of the element
var x = hypeDocument.getElementProperty(boxElement, "left");
var y = hypeDocument.getElementProperty(boxElement, "top");
// add to the positions array
positions.push({"x" : x, "y" : y});
}
// write out our result to the developer console
console.log(positions);
2 Likes
Yes! Though about that last night. It came to me in a dream Sometimes the easiest way is the best way. Thanks for your comment, once again!
1 Like