Jump to content
Search Community

get timeline as a string

Michael Barsotti test
Moderator Tag

Recommended Posts

I'm sure this is a very fringe case but is there a way to get a timeline as a string? For example if my javaScript is

var timeline = gsap.timeline();

timeline.set(text1,{autoAlpha:0})

    .addLabel("one","+=1")

    .to(text1,{duration:2,autoAlpha:1},"one");

 

I would like to use something like

console.log(timeline.toString());

and get

timeline.set(text1,{autoAlpha:0}).addLabel("one","+=1").to(text1,{duration:2,autoAlpha:1},"one");

 

Thank you.

Link to comment
Share on other sites

No, sorry, that isn't possible. Animation objects are far more complex than that and can include function-based values, other objects, and many other things, so it's just impossible to convert it all to a string cleanly. You could certainly build a function that parses a timeline and returns as much as possible as a string, but that definitely isn't built-in (it would cost a LOT of kb that almost nobody would use, so it'd be quite wasteful to include it in the core). 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...