首页 > 解决方案 > 如何在浏览器 (Chrome) 中从我的应用创建视频?

问题描述

如何从 Javascript 中的 div(或其他 DOM 元素)中运行的动画创建视频文件。例如:

<!DOCTYPE html>
<html>
<head>
<style> 
div {
  width: 100px;
  height: 100px;
  background-color: red;
  position: relative;
  animation-name: example;
  animation-duration: 4s;
  animation-delay: 0s;
}

@keyframes example {
  0%   {background-color:red; left:0px; top:0px;}
  25%  {background-color:yellow; left:200px; top:0px;}
  50%  {background-color:blue; left:200px; top:200px;}
  75%  {background-color:green; left:0px; top:200px;}
  100% {background-color:red; left:0px; top:0px;}
}
</style>
</head>
<body>

<p><b>Note:</b> This example does not work in Internet Explorer 9 and earlier versions.</p>

<div></div>

</body>
</html>

所以,我希望将这个动画保存在 .avi 或 .mp4 之类的文件中……我做了很多研究,但没有得到满意的解决方案。就像 html2canvas() 之类的东西,似乎只是为了打印。PS:在 Javascript 中(使用任何库、插件?)

标签: javascripthtmlvideo-capture

解决方案


推荐阅读