123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- export default {
-
- postData: (url, data) => {
- return fetch(url, {
- body: JSON.stringify(data),
- // cache: 'no-cache',
- // credentials: 'same-origin',
- headers: {
- // 'user-agent': 'Mozilla/4.0 MDN Example',
- 'content-type': 'application/json'
- },
- method: 'POST',
- // mode: 'cors',
- // redirect: 'follow',
- // referrer: 'no-referrer',
- })
- .then(response => response.json())
- },
- createVideoElement: (path) => {
- let videoName = path.split("/")[path.split("/").length-1].split(".")[0]
- let oldVideo = document.getElementById(videoName)
- if(oldVideo) {
- oldVideo.currentTime = 0
- oldVideo.isLoaded = true
- return oldVideo
- }
- let video = document.createElement("video")
- video.src = path
- video.id = videoName
- video.crossOrigin = "anonymous"
- video.playsinline = "playsinline"
- video.autoplay = "autoplay"
- video.muted = "muted"
- document.getElementById("videoTextureBox").appendChild(video)
-
- return video
- },
- getLengthBetweenVec3: (v1, v2) => {
- return Math.sqrt(
- (v1.x - v2.x) * (v1.x - v2.x) +
- (v1.y - v2.y) * (v1.y - v2.y) +
- (v1.z - v2.z) * (v1.z - v2.z)
- )
- }
- }
|