Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- let melies = null;
- // The default p5 WEBGL camera looks
- // at the origin (0, 0) of the canvas,
- // meaning we need half width and height.
- let halfw = 0.0;
- let halfh = 0.0;
- function preload() {
- melies = createVideo('assets/melies.ogv', onVideoLoad);
- }
- function onVideoLoad() {
- melies.loop();
- melies.hide();
- }
- function setup() {
- // Specify the WEBGL renderer.
- createCanvas(512, 256, WEBGL);
- halfw = width * 0.5;
- halfh = height * 0.5;
- noStroke();
- }
- function draw() {
- beginShape();
- texture(melies);
- // UV Coordinates default to NORMAL range
- // between 0 and 1.
- vertex(-halfw, -halfh, 0.0, 0.0, 0.0);
- vertex(halfw, -halfh, 0.0, 1.0, 0.0);
- vertex(halfw, halfh, 0.0, 1.0, 1.0);
- vertex(-halfw, halfh, 0.0, 0.0, 1.0);
- endShape(CLOSE);
- }
Add Comment
Please, Sign In to add comment