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...

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...