fileA.html
import zim from "https://zimjs.org/cdn/018/zim_three";
import pizzazz from "https://zimjs.org/cdn/018/zim_pizzazz";
var iframe = document.createElement('iframe');
iframe.style = `overflow:hidden;position: absolute;width:${window.innerWidth}px;height:${window.innerHeight / 2}px;border:medium none;top:50%;left:50%;transform:translate(-50%,-50%) ;z-index:2`
iframe.src = 'fileB.html';
document.body.appendChild(iframe);
new Frame(FIT, 2000, 2000, black, interstellar, ready);
function ready() {
var three = new Three({
width: window.innerWidth,
height: window.innerHeight,
cameraPosition: new THREE.Vector3(0, 0, 50),
ortho: true,
textureActive: true
});
var scene = three.scene;
var camera = three.camera;
var renderer = three.renderer;
// for HUD
var sceneOrtho = three.sceneOrtho;
var cameraOrtho = three.cameraOrtho;
// CONTROLS
var controls = new OrbitControls(camera, three.canvas);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
var panel = new TextureActive({
width: 600,
height: 200,
color: yellow.toAlpha(.1),
corner: 20
});
var textureActivesOrtho = new TextureActives([panel], THREE, three, renderer, sceneOrtho, cameraOrtho, controls);
var HUD_panel = three.makePanel(panel, textureActivesOrtho).pos(0, 30, CENTER, BOTTOM);
sceneOrtho.add(HUD_panel);
var type = new Pick(['pixels', 'noise', 'dots', 'stripes', 'slants', 'hatch', 'plaid', 'bling', 'check'])
var color = new Pick(series('#06a', '#0a0', '#a00', '#aa0'))
timeout(1.5,function(){
var patternA = makePattern({ type: 'stripes', colors:color, size: 20, interval: .400, startPaused: false, cache: false, cols: 48, rows: 20, spacingH: 4, spacingV: 4, })
var winEvent=new CustomEvent('sendToTexture',{ detail: patternA })
window.dispatchEvent(winEvent)
})
var patternB = makePattern({ type: 'stripes', colors: color, size: 20, interval: .400, startPaused: false, cache: false, cols: 48, rows: 20, spacingH: 4, spacingV: 4, })
.center(panel);
} // end ready
fileB.html
import zim from "https://zimjs.org/cdn/018/zim_three";
import pizzazz from "https://zimjs.org/cdn/018/zim_pizzazz";
new Frame(FIT, 2000, 2000, clear, clear, ready);
function ready() {
const three = new Three({
width: window.innerWidth,
height: window.innerHeight,
cameraPosition: new THREE.Vector3(0, 0, 50),
ortho: true,
textureActive: true
});
const scene = three.scene;
const camera = three.camera;
const renderer = three.renderer;
// for HUD
const sceneOrtho = three.sceneOrtho;
const cameraOrtho = three.cameraOrtho;
// CONTROLS
const controls = new OrbitControls(camera, three.canvas);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// SCENEORTHO - TextureActive work on sceneOrtho with HUD
const panel = new TextureActive({
width: 600,
height: 200,
color: black.toAlpha(0.5),
corner: 20
});
const textureActivesOrtho = new TextureActives(
[panel],
THREE,
three,
renderer,
sceneOrtho,
cameraOrtho,
controls
);
const HUD_panel = three
.makePanel(panel, textureActivesOrtho)
.pos(0, 0, CENTER, CENTER);
sceneOrtho.add(HUD_panel);
window.parent.addEventListener("sendToTexture", function (winEvt) {
var zimObj = winEvt.detail;
zimObj.center(panel);
});
} // end ready
you can see the patternA have't animation,why?