Guest User

Untitled

a guest
Jul 16th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. 'use strict';
  2.  
  3. let melies = null;
  4.  
  5. // The default p5 WEBGL camera looks
  6. // at the origin (0, 0) of the canvas,
  7. // meaning we need half width and height.
  8. let halfw = 0.0;
  9. let halfh = 0.0;
  10.  
  11. function preload() {
  12. melies = createVideo('assets/melies.ogv', onVideoLoad);
  13. }
  14.  
  15. function onVideoLoad() {
  16. melies.loop();
  17. melies.hide();
  18. }
  19.  
  20. function setup() {
  21.  
  22. // Specify the WEBGL renderer.
  23. createCanvas(512, 256, WEBGL);
  24. halfw = width * 0.5;
  25. halfh = height * 0.5;
  26. noStroke();
  27. }
  28.  
  29. function draw() {
  30. beginShape();
  31. texture(melies);
  32.  
  33. // UV Coordinates default to NORMAL range
  34. // between 0 and 1.
  35. vertex(-halfw, -halfh, 0.0, 0.0, 0.0);
  36. vertex(halfw, -halfh, 0.0, 1.0, 0.0);
  37. vertex(halfw, halfh, 0.0, 1.0, 1.0);
  38. vertex(-halfw, halfh, 0.0, 0.0, 1.0);
  39. endShape(CLOSE);
  40. }
Add Comment
Please, Sign In to add comment