Highlighted

Animate shape in plugin in c++

Community Beginner ,
Sep 30, 2020

Copy link to clipboard

Copied

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.  

Adobe Community Professional
Correct answer by shachar carmi | Adobe Community Professional

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

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

TOPICS
How to, Scripting, SDK

Views

81

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Animate shape in plugin in c++

Community Beginner ,
Sep 30, 2020

Copy link to clipboard

Copied

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.  

Adobe Community Professional
Correct answer by shachar carmi | Adobe Community Professional

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

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

TOPICS
How to, Scripting, SDK

Views

82

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 30, 2020 0
Adobe Community Professional ,
Sep 30, 2020

Copy link to clipboard

Copied

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

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 30, 2020 1
Community Beginner ,
Sep 30, 2020

Copy link to clipboard

Copied

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.

 

 

 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 30, 2020 0
Adobe Community Professional ,
Sep 30, 2020

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 30, 2020 0
Community Beginner ,
Sep 30, 2020

Copy link to clipboard

Copied

Sorry, now it is clear!

Thanks!

Yaroslav.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 30, 2020 0