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

p5.js library with Adobe Animate?

New Here ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

Hi, I have learned a bit of code using p5.js. I would like to include some of my scripts written in p5.js in  Adobe Animate html5 projects. I have added p5.js using the include. And I can copy and paste a script into animate and run it it but it only works if I create a separate canvas, obviously I need to draw to the Animate canvas instead.

Any advice would be appreciated. Here's an example of a script I'd like to draw directly into an Animate project.

 

https://editor.p5js.org/daniellefcourt/sketches/lDnqYHvuF

Views

598

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

LEGEND , Dec 02, 2021 Dec 02, 2021

P5 is a framework for drawing on the canvas.

 

Animate uses its own framework for drawing on the canvas, CreateJS.

 

You cannot have two frameworks controlling the same canvas, because they will fight each other for control of it. The best you could hope for is to have two identical canvases stacked on top of each other, each controlled by a different framework, with the top one set transparent so you can see both of them. This would be a horrible, wasteful solution.

 

If you really want to crea

...

Votes

Translate

Translate
Community Expert ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

you should be able to use any canvas project, include your libraries and code (after those libraries load) using those library dependencies.

 

what problem are you having doing 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
New Here ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

Thanks for the reply.

Here's a sample. I can create this simple ellipse in p5.js

 

When I add the code to AA it creates a new canvas, under the AA one.

If I delete createCanvas it still doesn't render to AA canvas.

Screen Shot 2021-12-02 at 11.30.40 AM.png

 

Screen Shot 2021-12-02 at 11.31.38 AM.png

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
LEGEND ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

P5 is a framework for drawing on the canvas.

 

Animate uses its own framework for drawing on the canvas, CreateJS.

 

You cannot have two frameworks controlling the same canvas, because they will fight each other for control of it. The best you could hope for is to have two identical canvases stacked on top of each other, each controlled by a different framework, with the top one set transparent so you can see both of them. This would be a horrible, wasteful solution.

 

If you really want to created scripted animations in Animate, you should give up on P5 and get learning CreateJS.

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
New Here ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

OK. Thanks for your help. That's what I wasn't understanding.

 

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
New Here ,
Dec 02, 2021 Dec 02, 2021

Copy link to clipboard

Copied

One question. As a beginner, would you recommend I learn ActionScript first, or just dive into javascript using CreateJS?

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
LEGEND ,
Dec 03, 2021 Dec 03, 2021

Copy link to clipboard

Copied

LATEST

ActionScript is only for ActionScript documents. JavaScript/CreateJS is only for HTML5 Canvas documents.

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