Upped Processing.js to 1.3.6, plus fixes to examples for 1.3.6

This commit is contained in:
fjenett
2011-11-06 11:44:43 +00:00
parent 40a2e4f0cc
commit f8c43eb3a6
6 changed files with 5625 additions and 15197 deletions

View File

@@ -24,7 +24,7 @@
if ( video != null )
{
PImage frame = getFrame(video);
PImage frame = video.getFrame();
float br = 0;
color px;
for ( int ix = 0; ix < frame.width; ix += 7 )
@@ -53,9 +53,10 @@
{
if ( video != null )
{
// this currently does not work for chrome with our server
video.currentTime = map(constrain(mouseX,0,width-10),0,width-10,0,video.duration);
wasDragged = true;
video.pause();
wasDragged = true;
}
}
@@ -77,12 +78,6 @@
video = v;
}
/* copy video image to PImage */
PImage getFrame ( Video v )
{
return new PImage(v); // sub-optimal ..
}
/* make Processing understand the HTMLVideoElement */
interface Video
{

View File

@@ -6,6 +6,13 @@ window.onload = function () {
var sketch = Processing.instances[0];
if ( sketch == undefined )
return setTimeout(tryFindSketch, 200); // retry in 0.2 secs
// extending our HTMLVideoElement object to return a PImage
video['getFrame'] = function () {
var img = new sketch.PImage;
img.fromHTMLImageData(video);
return img;
};
(function( s, v ){
var tryAddVideo = function () {
@@ -19,6 +26,8 @@ window.onload = function () {
})( sketch, video );
}
// looping currently not working in chrome as our internal server does
// not support http byte ranges
addEvent(video,'ended',function(){
if ( 'loop' in this && this.loop ) {
this.currentTime = 0;

View File

@@ -41,7 +41,7 @@
timeLineEffects();
PImage frame = getFrame(video);
PImage frame = video.getFrame();
PImage rgbImage = frame.get(frame.width/2,0,frame.width/2,frame.height);
PImage maskImage = frame.get(0,0,frame.width/2,frame.height);
rgbImage.mask(maskImage);
@@ -65,12 +65,6 @@
video = v;
}
/* copy video image to PImage */
PImage getFrame ( Video v )
{
return new PImage(v); // sub-optimal ..
}
/* make Processing understand the HTMLVideoElement */
interface Video
{

View File

@@ -20,6 +20,13 @@ function initVideos ( sketch ) {
video['loop'] = true; // as "loop" is not supported by many browsers
// extending our HTMLVideoElement object to return a PImage
video['getFrame'] = function () {
var img = new sketch.PImage;
img.fromHTMLImageData(video);
return img;
};
// similar to tryFindSketch this creates a loop that
// continues until the video becomes ready.
(function( s, v ){