• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Is there a way to make Animate automatically do that ? (like a macro)

Contributor ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

I'm making animations with Adobe Animate and importing layers from Photoshop.

Sometimes I've got like 34 or 40 layers and I have to manually do that :

Capturer 04 - Streamable

Is there a way to make Animate automatically do that ? (putting each layer after the previous one ?)

Thank you for your help

Views

1.2K

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
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 10, 2018 Mar 10, 2018

Hi.

 

Here is a script that does what you need.

 

Probably k will give you a most efficient way of doing this, but, for now, I think it can help you.

 

Feel free to improve it in any way desired.

 

UPDATE (03/23/2023):

I didn't review the code. Just grabbed it from another folder I have in Google Drive.

var defaultValue = "3";
var space = prompt("Type the pyramid edge width.", defaultValue);
var doc = fl.getDocumentDOM();
var timeline = fl.getDocumentDOM().getTimeline();
var selectedLayers = tim
...

Votes

Translate

Translate
Community Expert ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

yes.  you can use jsfl to automate that task.

Votes

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
community guidelines
Contributor ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

Ok.. Do you have any tutorial how to do that ?

Votes

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
community guidelines
Community Expert ,
Mar 09, 2018 Mar 09, 2018

Copy link to clipboard

Copied

i haven't made a tutorial but you could search for one using google:  jsfl tutorial

Votes

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
community guidelines
Contributor ,
Mar 10, 2018 Mar 10, 2018

Copy link to clipboard

Copied

Thank you. I've just read this tuto and understood how this is working.

But, as I'm not good at all at Javascript language, do you know how can I tell, in javascript, to add 3 frames to each layers and to put the next layer after the previous one (like in my video) ?

Votes

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
community guidelines
Community Expert ,
Mar 10, 2018 Mar 10, 2018

Copy link to clipboard

Copied

Hi.

 

Here is a script that does what you need.

 

Probably k will give you a most efficient way of doing this, but, for now, I think it can help you.

 

Feel free to improve it in any way desired.

 

UPDATE (03/23/2023):

I didn't review the code. Just grabbed it from another folder I have in Google Drive.

var defaultValue = "3";
var space = prompt("Type the pyramid edge width.", defaultValue);
var doc = fl.getDocumentDOM();
var timeline = fl.getDocumentDOM().getTimeline();
var selectedLayers = timeline.getSelectedLayers();
var count;
var increment;

function start()
{
	if (!doc || !selectedLayers || selectedLayers.length == 1 || space == null)
		return;
	else
	{
		space = space.replace(/\s/g,'');
		
		if (isNaN(parseFloat(space)) || space <= 0)
			return;
		else
			count = Number(space);
		
		increment = count;
	}
	
	for (var i = selectedLayers.length - 1; i >= 0; i--)
	{	
		timeline.setSelectedLayers(selectedLayers[i], true);		
		timeline.insertFrames(count, false, 0);		
		timeline.insertKeyframe(count - (increment - 1));
		count += increment;
	}
}

start();

-----------------------------------------------------------------------------------------------------------------------

 

JSFL download: layers_pyramid.jsfl - Google Drive

 

Usage:

Select the layers you want, type in the value of the pyramid's edges or leave the default and press 'OK'.

 

Code (for reference):

var defaultValue = "3";

var space = prompt("Type the pyramid edge width.", defaultValue);

var doc = fl.getDocumentDOM();

var timeline = fl.getDocumentDOM().getTimeline();

var selectedLayers = timeline.getSelectedLayers();

var count;

var increment;

 

function start()

{

    if (!doc || !selectedLayers || selectedLayers.length == 1 || space == null)

        return;

    else

    {

        space = space.replace(/\s/g,'');

       

        if (isNaN(parseFloat(space)) || space <= 0)

            return;

        else

            count = Number(space);

       

        increment = count;

    }

   

    for (var i = selectedLayers.length - 1; i >= 0; i--)

    {   

        timeline.setSelectedLayers(selectedLayers, true);       

        timeline.insertFrames(count, false, 0);       

        timeline.insertKeyframe(count - (increment - 1));

        count += increment;

    }   

}

 

start();

 

Demonstration:

jsfl_layers_pyramid.gif

 

I hope it helps.

 

Regards,

JC

Votes

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
community guidelines
Contributor ,
Mar 10, 2018 Mar 10, 2018

Copy link to clipboard

Copied

Super thanks for this answer and the code! Unfortunately, I've just tested it but it doesn't seems to work (nothing is happening) :

Capturer 01 - Streamable

Votes

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
community guidelines
Community Expert ,
Mar 10, 2018 Mar 10, 2018

Copy link to clipboard

Copied

Great!

You have to select the layers first.

Sorry, because I edited my comment and you probably didn't see the update.

Votes

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
community guidelines
Contributor ,
Mar 10, 2018 Mar 10, 2018

Copy link to clipboard

Copied

Here's what's happening when I'm selecting all the layers :

Capturer 03 - Streamable

Votes

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
community guidelines
Community Expert ,
Mar 10, 2018 Mar 10, 2018

Copy link to clipboard

Copied

Sorry about the inconvenience.

I've updated the script. Please try again.

Now you can apply it to any number of layers.

The only thing that it won't do right now is to remove the contents of the first frames. It seems trivial but it turns out that it isn't.

As soon as I find a solution, I'll get back to you.

Votes

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
community guidelines
Community Expert ,
Mar 10, 2018 Mar 10, 2018

Copy link to clipboard

Copied

Little demonstration:

jsfl_layers_pyramid.gif

Votes

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
community guidelines
Contributor ,
Mar 10, 2018 Mar 10, 2018

Copy link to clipboard

Copied

GREAT !!! Thank you very much for this ! Awesome !

Votes

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
community guidelines
Contributor ,
Mar 28, 2023 Mar 28, 2023

Copy link to clipboard

Copied

can you send it again

Votes

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
community guidelines
Community Expert ,
Mar 28, 2023 Mar 28, 2023

Copy link to clipboard

Copied

Hi.

 

You can copy the code from the accepted answer (in the comment body itself).

Please let me know if there's some issue.

 

Regards,

JC

Votes

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
community guidelines
Contributor ,
Mar 28, 2023 Mar 28, 2023

Copy link to clipboard

Copied

line 51,A javascript error occurred

Votes

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
community guidelines
Community Expert ,
Mar 28, 2023 Mar 28, 2023

Copy link to clipboard

Copied

LATEST

Thanks for pointing that out.

 

This should be the correct code:

var defaultValue = "3";
var space = prompt("Type the pyramid edge width.", defaultValue);
var doc = fl.getDocumentDOM();
var timeline = fl.getDocumentDOM().getTimeline();
var selectedLayers = timeline.getSelectedLayers();
var count;
var increment;

function start()
{
	if (!doc || !selectedLayers || selectedLayers.length == 1 || space == null)
		return;
	else
	{
		space = space.replace(/\s/g,'');
		
		if (isNaN(parseFloat(space)) || space <= 0)
			return;
		else
			count = Number(space);
		
		increment = count;
	}
	
	for (var i = selectedLayers.length - 1; i >= 0; i--)
	{	
		timeline.setSelectedLayers(selectedLayers[i], true);		
		timeline.insertFrames(count, false, 0);		
		timeline.insertKeyframe(count - (increment - 1));
		count += increment;
	}
}

start();

Votes

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
community guidelines
Contributor ,
Mar 10, 2018 Mar 10, 2018

Copy link to clipboard

Copied

Something is happening when I'm selecting only the 4 first layers... :

Capturer 02 - Streamable

Votes

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
community guidelines