Skip to content

Instantly share code, notes, and snippets.

@leylaKapi
Forked from arirusso/video-example.rb
Created May 2, 2018 08:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leylaKapi/f25764dab0d54012b562e0ce5883b868 to your computer and use it in GitHub Desktop.
Save leylaKapi/f25764dab0d54012b562e0ce5883b868 to your computer and use it in GitHub Desktop.
ruby-processing: video processing example
#!/usr/bin/env ruby
# this is a test of ruby-processing (https://github.com/jashkenas/ruby-processing) with the video library
# use "rp5 unpack library" at a command line to install the video library, among others
# tested with Ruby 1.9.2
# video file: http://bit.ly/H5yBjK
class VideoTest < Processing::App
load_library :video
include_package "processing.video"
def setup
size(640, 480, P2D)
@movie = Movie.new(self, "data/sample.mov")
@movie.play
end
def draw
tint(*Array.new(3) { rand(256) })
image(@movie, 0,0)
end
def movie_event(m)
m.read
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment