UNPKG

lingo3d

Version:

Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor

22 lines 854 B
import { RepeatWrapping, Texture, VideoTexture } from "three"; import { forceGet } from "@lincode/utils"; import { isSelector } from "../../../utils/isSelector"; const cache = new Map(); export default (url) => forceGet(cache, url, () => { if (isSelector(url)) { const video = document.querySelector(url); if (video instanceof HTMLVideoElement) return new VideoTexture(video, undefined, RepeatWrapping, RepeatWrapping); return new Texture(); } const video = document.createElement("video"); video.crossOrigin = "anonymous"; video.src = url; video.loop = true; video.autoplay = true; video.muted = true; video.playsInline = true; video.play(); return new VideoTexture(video, undefined, RepeatWrapping, RepeatWrapping); }).clone(); //# sourceMappingURL=loadVideoTexture.js.map