three实现多窗体共享的三维小球旋转动画效果代码
代码语言:html
所属分类:三维
代码描述:three实现多窗体共享的三维小球旋转动画效果代码,打开新的窗体,新增小球会实时显示。
代码标签: three 多窗体 共享 三维 小球 旋转 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.124.js"></script>
<style type="text/css">
*
{
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<script type="module" >
class WindowManager
{
#windows;
#count;
#id;
#winData;
#winShapeChangeCallback;
#winChangeCallback;
constructor ()
{
let that = this;
// event listener for when localStorage is changed from another window
addEventListener("storage", (event) =>
{
if (event.key == "windows")
{
let newWindows = JSON.parse(event.newValue);
let winChange = that.#didWindowsChange(that.#windows, newWindows);
that.#windows = newWindows;
if (winChange)
{
if (that.#winChangeCallback) that.#winChangeCallback();
}
}
});
// event listener for when current window is about to ble closed
window.addEventListener('beforeunload', function (e)
{
let index = that.getWindowIndexFromId(that.#id);
//remove this window from the list and update local storage
that.#windows.splice(index, 1);
that.updateWindowsLocalStorage();
});
}
// ch.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0