Canvas

Canvas VR mode Fullscreen

Förkortningar

  • ctx - Context

Rendera en HTML-video på Canvas med JavaScript

var canvas = document.getElementById('canvas'); var ctx = canvas.getContext('2d'); var video = document.getElementById('video'); video.addEventListener('play', function() { var $this = this; //cache (function loop() { if (!$this.paused && !$this.ended) { ctx.drawImage($this, 0, 0); setTimeout(loop, 1000 / 30); // drawing at 30fps } })(); }, 0); canvas = document.createElement('canvas'); ctx = canvas.getContext('webgl') || canvas.getContext('experimental-webgl'); alert(ctx.getSupportedExtensions());

How can I enable WebGL in my browser?

HTML5 load a png buffer into a canvas (for streaming purpose)

Kuriosa

Externa länkar