Skip to content

Instantly share code, notes, and snippets.

@spleenteo
Last active April 1, 2016 08:15
Show Gist options
  • Save spleenteo/1880364cead389679b7c5b77cbb1a7e1 to your computer and use it in GitHub Desktop.
Save spleenteo/1880364cead389679b7c5b77cbb1a7e1 to your computer and use it in GitHub Desktop.
cameraStill.coffee
# live demo http://share.framerjs.com/raf9vavekxei/
# suppose to have different initial layers
# * camera_player_frame <- where video plays
# * photo_shooter <- the button to shoot
# get the module from https://github.com/ktcy/CameraLayer
CameraLayer = require "cameraLayer"
camera = new CameraLayer
camera.parent = camera_player_frame
camera.size = camera_player_frame.size
camera.start()
photo_shooter.on Events.Click, ->
photo = new Layer
photo.parent = camera_player_frame
photo.size = camera_player_frame.size
photo._alwaysUseImageCache = true # this is the magic line
photo.image = camera.capture()
camera.destroy()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment