Skip to main content
Inspiring
September 30, 2020
Answered

Animate shape in plugin in c++

  • September 30, 2020
  • 1 reply
  • 635 views

Dear AE fellows.

I'm trying to write a plugin for AE in c++.

 

So far I've learnt  how to draw simple curves. What I don't know is how to animate these curves as the user moves a time slider in timeline  panel. 

 

Suppose I draw a circle:

_____________________________________

double x = 100;

double y = 100;

double R = 50;

double phi1 = 0.;

double phi2 = 2*MF_PI.;

cairo_t *cr = cairo_create(surface);

cairo_arc(cr, x, y, R, phi1, phi2);

 _____________________________________

 

I want the radius of the circle to change as the user moves time slider from 0 to 30 frames.

How do you achieve this?

 

Yaroslav.  

This topic has been closed for replies.
Correct answer shachar carmi

in_data->current_time is the current frame's time step.

in_data->time_step is the number of steps per second.

1 reply

shachar carmiCommunity ExpertCorrect answer
Community Expert
September 30, 2020

in_data->current_time is the current frame's time step.

in_data->time_step is the number of steps per second.

Inspiring
September 30, 2020

Thank you, Shachar!

Sorry, I'd like to eleborate slightly.

 

Suppose I have a complicated shape as a fuction of time: shape(t).

Just let me point out some details about this shape (these may be relevant)

It is a combination of bezier curves. At t=0 it has, say, 40 paths, at t=30 frames, it has 100 paths.

Therefore, I can't simply set two moments of time and tell Adobe After to interpolate the shape between to time points. 

This shape is computed with the help of function shape(t) at each moment of time.

 

Could you (if it is not time consuming) to elaborate slightly more about the code?

 

Yaroslav.

 

 

 

 

 

Community Expert
September 30, 2020

i probably don't understand the problem.

AE calls the plug-in to render a frame with a given time. when renderin a sequence of 30 frames, AE will call the plug-in 30 times, each with a corresponding time stamp.

what's keeping you from calling shape(t) for each requested frame?