Jump to content

Using Ccapture.js to capture Pixi.js animation


DonnyV
 Share

Recommended Posts

Has anyone tried using Ccapture.js with Pixi?

I tried but it seems to just stop the animation and nothing gets captured.

I got it animating now but the .webm video is just showing black.

var renderer = PIXI.autoDetectRenderer(800, 600,{
    backgroundColor : 0x1099bb,
    view: document.getElementById("view")
});

// create the root of the scene graph
var stage = new PIXI.Container();


var style = {
    fontFamily : 'Arial',
    fontSize : '36px',
    fontStyle : 'italic',
    fontWeight : 'bold',
    fill : '#F7EDCA',
    stroke : '#4a1850',
    strokeThickness : 5,
    dropShadow : true,
    dropShadowColor : '#000000',
    dropShadowAngle : Math.PI / 6,
    dropShadowDistance : 6,
    wordWrap : false,
    wordWrapWidth : 440
};

// var richText = new PIXI.Text('Rich text with a lot of options and across multiple lines',style);
// richText.x = 30;
// richText.y = 180;

//stage.addChild(richText);
var yincr = 0;
for (var i = 0; i < 200; i++) { 
    yincr = yincr + 40;

    var richText = new PIXI.Text('Rich text with a lot of options and across multiple lines',style);
    richText.x = 30;
    richText.y = yincr;

    stage.addChild(richText);
}

// Create a capturer that exports a WebM video
var capturer = new CCapture({ 
    format: 'webm',
    framerate: 60,
    verbose: true
} );

capturer.start();

// start animating
animate();

function animate() {

    requestAnimationFrame(animate);

    capturer.capture(document.getElementById("view"));

    stage.position.y -= 1;

    // render the root container
    renderer.render(stage);

    if(stage.position.y == -10){
        capturer.stop();

        // default save, will download automatically a file called {name}.extension (webm/gif/tar)
        capturer.save();

        return;
    }
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...