Jump to content

webcam


valentinaCom
 Share

Recommended Posts

Simple :)

var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create });function preload () {    game.load.script('webcam', '../plugins/WebCam.js');}var webcam;var bmd;var sprite;function create () {    webcam = game.plugins.add(Phaser.Plugin.Webcam);    bmd = game.make.bitmapData(800, 600);    sprite = bmd.addToWorld();    webcam.start(800, 600, bmd.context);    game.input.onDown.addOnce(takePicture, this);}function takePicture () {    webcam.stop();    //  bmd.context now contains your webcam image    sprite.tint = Math.random() * 0xff0000;}
Link to comment
Share on other sites

  • 3 weeks later...
 Share

  • Recently Browsing   0 members

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