h5画布动画_如何使用CCapture保存画布动画

本文介绍了如何使用CCapture.js库来保存p5.js创建的画布动画,包括设置帧率、捕获动画帧以及使用ffmpeg转换为不同格式。通过设置别名,可以方便地重复使用ffmpeg选项。
摘要由CSDN通过智能技术生成

h5画布动画

by Ibby EL-Serafy

由Ibby EL-Serafy

如何使用CCapture保存画布动画 (How to save canvas animations with CCapture)

You’ve been learning p5.js and you’ve created a wonderful animation and now you want to share it with the world. How do you go about that?

您一直在学习p5.js,并且已经创建了一个很棒的动画,现在想与世界分享。 您如何处理?

We could use screen capture software, but this only works if the animation is running at the right speed. With the above animation, I was getting less than half a frame per second. The ccapture.js library is mentioned in the p5.js documentation and has worked well for me.

我们可以使用屏幕捕获软件,但这仅在动画以正确的速度运行时才有效。 通过上面的动画,我每秒不到半帧。 p5.j​​s文档中提到了ccapture.js库,对我来说效果很好。

If you’d like to follow along with this tutorial you can fork the sandbox below, which has all the code you’ll need to start.

如果您想按照本教程进行操作,可以在下面的沙箱中创建分支,其中包含您需要启动的所有代码。

View my codesandbox here.

在这里查看我的密码和邮箱。

The first thing we’ll need to do is download the minified CCapture javascript file. We’ll move the file into our project folder, or upload it to our sandbox folder. Then we need to add it to our index.html file:

我们需要做的第一件事是下载缩小的CCapture javascript文件 。 我们将文件移动到我们的项目文件夹中,或将其上传到我们的沙盒文件夹中。 然后,我们需要将其添加到我们的index.html文件中:

<script src="p5.min.js"></script>&
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值