save css animation to jpeg/png in nodejs











up vote
1
down vote

favorite
1












I know that I can write my own animations in phaser or other framework and save jpg of that into a file, or use jimp.



https://www.npmjs.com/package/jimp



However, I would like to know if I can use css animation and then save what I see in front-end into a file in my node backend.



Is there a css engine that I can use to achieve this?



What about these? I think all of them do the animation in client side. https://blog.bitsrc.io/11-javascript-animation-libraries-for-2018-9d7ac93a2c59



I don't want to write any code for each css effect (I wrote a lot for a java application and it is still not satisfying)










share|improve this question


























    up vote
    1
    down vote

    favorite
    1












    I know that I can write my own animations in phaser or other framework and save jpg of that into a file, or use jimp.



    https://www.npmjs.com/package/jimp



    However, I would like to know if I can use css animation and then save what I see in front-end into a file in my node backend.



    Is there a css engine that I can use to achieve this?



    What about these? I think all of them do the animation in client side. https://blog.bitsrc.io/11-javascript-animation-libraries-for-2018-9d7ac93a2c59



    I don't want to write any code for each css effect (I wrote a lot for a java application and it is still not satisfying)










    share|improve this question
























      up vote
      1
      down vote

      favorite
      1









      up vote
      1
      down vote

      favorite
      1






      1





      I know that I can write my own animations in phaser or other framework and save jpg of that into a file, or use jimp.



      https://www.npmjs.com/package/jimp



      However, I would like to know if I can use css animation and then save what I see in front-end into a file in my node backend.



      Is there a css engine that I can use to achieve this?



      What about these? I think all of them do the animation in client side. https://blog.bitsrc.io/11-javascript-animation-libraries-for-2018-9d7ac93a2c59



      I don't want to write any code for each css effect (I wrote a lot for a java application and it is still not satisfying)










      share|improve this question













      I know that I can write my own animations in phaser or other framework and save jpg of that into a file, or use jimp.



      https://www.npmjs.com/package/jimp



      However, I would like to know if I can use css animation and then save what I see in front-end into a file in my node backend.



      Is there a css engine that I can use to achieve this?



      What about these? I think all of them do the animation in client side. https://blog.bitsrc.io/11-javascript-animation-libraries-for-2018-9d7ac93a2c59



      I don't want to write any code for each css effect (I wrote a lot for a java application and it is still not satisfying)







      css node.js animation






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 10 at 18:47









      Soley

      1,1391322




      1,1391322
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          In order to save a rendered animation to a file you need to record that webpage at a very high framerate, then convert all those captured frames to an animated format like GIF (jpeg and png don't support animations as far as I know).



          To capture a webpage, you could try phantomjs

          Here's an article that explains this: Recording a Website with phantomjs and ffmpeg



          var page = require("webpage").create();
          page.viewportSize = { width: 640, height: 480 };

          page.open("http://www.goodboydigital.com/pixijs/examples/12-2/", function() {
          setInterval(function() {
          page.render("/dev/stdout", { format: "png" });
          }, 25);
          });




          phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 25 -t 10  -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart dragon.mp4


          The output in this example is mp4 but you could probably tweak the command line params to get a gif.






          share|improve this answer





















          • Thanks for your very nice reply, I will mark this as answer when no one else replied in a week. You made me really happy with this!
            – Soley
            Nov 11 at 19:38










          • thanks, no problem
            – mihai
            Nov 11 at 19:39










          • What about puppeteer? I was experimenting with it, however, I don't think it can render as fast as 30fps ?
            – Soley
            Nov 11 at 19:58










          • Not sure, needs to be tested. However I found this issue: github.com/GoogleChrome/puppeteer/issues/476
            – mihai
            Nov 11 at 20:08











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242282%2fsave-css-animation-to-jpeg-png-in-nodejs%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          In order to save a rendered animation to a file you need to record that webpage at a very high framerate, then convert all those captured frames to an animated format like GIF (jpeg and png don't support animations as far as I know).



          To capture a webpage, you could try phantomjs

          Here's an article that explains this: Recording a Website with phantomjs and ffmpeg



          var page = require("webpage").create();
          page.viewportSize = { width: 640, height: 480 };

          page.open("http://www.goodboydigital.com/pixijs/examples/12-2/", function() {
          setInterval(function() {
          page.render("/dev/stdout", { format: "png" });
          }, 25);
          });




          phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 25 -t 10  -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart dragon.mp4


          The output in this example is mp4 but you could probably tweak the command line params to get a gif.






          share|improve this answer





















          • Thanks for your very nice reply, I will mark this as answer when no one else replied in a week. You made me really happy with this!
            – Soley
            Nov 11 at 19:38










          • thanks, no problem
            – mihai
            Nov 11 at 19:39










          • What about puppeteer? I was experimenting with it, however, I don't think it can render as fast as 30fps ?
            – Soley
            Nov 11 at 19:58










          • Not sure, needs to be tested. However I found this issue: github.com/GoogleChrome/puppeteer/issues/476
            – mihai
            Nov 11 at 20:08















          up vote
          1
          down vote













          In order to save a rendered animation to a file you need to record that webpage at a very high framerate, then convert all those captured frames to an animated format like GIF (jpeg and png don't support animations as far as I know).



          To capture a webpage, you could try phantomjs

          Here's an article that explains this: Recording a Website with phantomjs and ffmpeg



          var page = require("webpage").create();
          page.viewportSize = { width: 640, height: 480 };

          page.open("http://www.goodboydigital.com/pixijs/examples/12-2/", function() {
          setInterval(function() {
          page.render("/dev/stdout", { format: "png" });
          }, 25);
          });




          phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 25 -t 10  -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart dragon.mp4


          The output in this example is mp4 but you could probably tweak the command line params to get a gif.






          share|improve this answer





















          • Thanks for your very nice reply, I will mark this as answer when no one else replied in a week. You made me really happy with this!
            – Soley
            Nov 11 at 19:38










          • thanks, no problem
            – mihai
            Nov 11 at 19:39










          • What about puppeteer? I was experimenting with it, however, I don't think it can render as fast as 30fps ?
            – Soley
            Nov 11 at 19:58










          • Not sure, needs to be tested. However I found this issue: github.com/GoogleChrome/puppeteer/issues/476
            – mihai
            Nov 11 at 20:08













          up vote
          1
          down vote










          up vote
          1
          down vote









          In order to save a rendered animation to a file you need to record that webpage at a very high framerate, then convert all those captured frames to an animated format like GIF (jpeg and png don't support animations as far as I know).



          To capture a webpage, you could try phantomjs

          Here's an article that explains this: Recording a Website with phantomjs and ffmpeg



          var page = require("webpage").create();
          page.viewportSize = { width: 640, height: 480 };

          page.open("http://www.goodboydigital.com/pixijs/examples/12-2/", function() {
          setInterval(function() {
          page.render("/dev/stdout", { format: "png" });
          }, 25);
          });




          phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 25 -t 10  -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart dragon.mp4


          The output in this example is mp4 but you could probably tweak the command line params to get a gif.






          share|improve this answer












          In order to save a rendered animation to a file you need to record that webpage at a very high framerate, then convert all those captured frames to an animated format like GIF (jpeg and png don't support animations as far as I know).



          To capture a webpage, you could try phantomjs

          Here's an article that explains this: Recording a Website with phantomjs and ffmpeg



          var page = require("webpage").create();
          page.viewportSize = { width: 640, height: 480 };

          page.open("http://www.goodboydigital.com/pixijs/examples/12-2/", function() {
          setInterval(function() {
          page.render("/dev/stdout", { format: "png" });
          }, 25);
          });




          phantomjs runner.js | ffmpeg -y -c:v png -f image2pipe -r 25 -t 10  -i - -c:v libx264 -pix_fmt yuv420p -movflags +faststart dragon.mp4


          The output in this example is mp4 but you could probably tweak the command line params to get a gif.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 11 at 19:09









          mihai

          22.6k73968




          22.6k73968












          • Thanks for your very nice reply, I will mark this as answer when no one else replied in a week. You made me really happy with this!
            – Soley
            Nov 11 at 19:38










          • thanks, no problem
            – mihai
            Nov 11 at 19:39










          • What about puppeteer? I was experimenting with it, however, I don't think it can render as fast as 30fps ?
            – Soley
            Nov 11 at 19:58










          • Not sure, needs to be tested. However I found this issue: github.com/GoogleChrome/puppeteer/issues/476
            – mihai
            Nov 11 at 20:08


















          • Thanks for your very nice reply, I will mark this as answer when no one else replied in a week. You made me really happy with this!
            – Soley
            Nov 11 at 19:38










          • thanks, no problem
            – mihai
            Nov 11 at 19:39










          • What about puppeteer? I was experimenting with it, however, I don't think it can render as fast as 30fps ?
            – Soley
            Nov 11 at 19:58










          • Not sure, needs to be tested. However I found this issue: github.com/GoogleChrome/puppeteer/issues/476
            – mihai
            Nov 11 at 20:08
















          Thanks for your very nice reply, I will mark this as answer when no one else replied in a week. You made me really happy with this!
          – Soley
          Nov 11 at 19:38




          Thanks for your very nice reply, I will mark this as answer when no one else replied in a week. You made me really happy with this!
          – Soley
          Nov 11 at 19:38












          thanks, no problem
          – mihai
          Nov 11 at 19:39




          thanks, no problem
          – mihai
          Nov 11 at 19:39












          What about puppeteer? I was experimenting with it, however, I don't think it can render as fast as 30fps ?
          – Soley
          Nov 11 at 19:58




          What about puppeteer? I was experimenting with it, however, I don't think it can render as fast as 30fps ?
          – Soley
          Nov 11 at 19:58












          Not sure, needs to be tested. However I found this issue: github.com/GoogleChrome/puppeteer/issues/476
          – mihai
          Nov 11 at 20:08




          Not sure, needs to be tested. However I found this issue: github.com/GoogleChrome/puppeteer/issues/476
          – mihai
          Nov 11 at 20:08


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53242282%2fsave-css-animation-to-jpeg-png-in-nodejs%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          The Sandy Post

          Danny Elfman

          Pages that link to "Head v. Amoskeag Manufacturing Co."