ievgennaida / animation-timeline-control

Canvas based TypeScript animation timeline editor.
MIT License
357 stars 65 forks source link

Could you tell me how to set and get this time?? #12

Closed qikong333 closed 4 years ago

qikong333 commented 4 years ago

image

ievgennaida commented 4 years ago

You can see the list of public methods here: https://github.com/ievgennaida/animation-timeline-control/blob/master/lib/timeline.d.ts or https://github.com/ievgennaida/animation-timeline-control/blob/master/src/timeline.ts

All available methods will be displayed in the popup if you are using IDE like visual studio code.

To set time units you can use:

timeline.setTime(4000);
timeline.redraw();

To get current time you can use:

timeline.getTime();

Or you can subscribe on time changed event:

TypeScript:

timeline.onTimeChanged((event: TimelineTimeChangedEvent) => {
  if(event.source !== TimelineEventSource.User){
  // Do something.
  }
});