Comments (4)
Here's a couple of threejs examples using canvas texture and VR sandbox using underlying HTMLMesh
from zimjs.
We want to do that too @IRobot1. Here is a solution - you can set the F.canvas.style.display = "none". You also need to move the threejs code into the ready event as the canvas needs to be ready. If you are animating then you need to add cube.material.map.needsUpdate = true; in the render loop. If you were not animating and not using the needsUpdate then you need to S.update() before doing the threejs code so there is something on the canvas when you add it. Note, we imported our three version... optional - which also has orbitcontrols.
<script type="module">
import zim from "https://zimjs.org/cdn/014/zim_three";
new Frame(FIT, 256, 256, light, dark, ready);
function ready() {
F.makeIcon(null,dark)
.sca(2)
.centerReg()
.animate({
props:{scale:1},
rewind:true,
loop:true
})
F.canvas.style.display = "none";
// S.update(); // if not animating, make sure to update the stage before applying texture
const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(
75,
window.innerWidth / window.innerHeight,
0.1,
1000
);
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
// ****
const canvastexture = new THREE.CanvasTexture(F.canvas)
const controls = new OrbitControls(camera, renderer.domElement);
const geometry = new THREE.PlaneGeometry();
const material = new THREE.MeshBasicMaterial({ map: canvastexture });
const cube = new THREE.Mesh(geometry, material);
scene.add(cube);
camera.position.z = 2;
const animate = () => {
requestAnimationFrame(animate);
// ***** if animating this is needed
cube.material.map.needsUpdate = true;
renderer.render(scene, camera);
};
animate()
} // end ready
</script>
from zimjs.
Test file: https://zimjs.com/test6/three.html
from zimjs.
https://zimjs.com/editor/view/Z_FFZ7D
from zimjs.
Related Issues (20)
- Frame LoadAssets Problem HOT 2
- centerReg() does not working on ZimJS version 10 HOT 2
- Label.labelWidth change issue. HOT 1
- Zim.Frame("tagID") does not work well. HOT 3
- In IE11, the Frame can't load all images succeeded in the first time. HOT 4
- [Question] Can a movable element be present on more than 1 square? HOT 1
- Refactoring code HOT 4
- hi, is it possible run on an environment which has no dom bom environment HOT 25
- h and v scroll conflicts list & window. HOT 7
- 2 bugs found. HOT 2
- bug report: SVGContainer("xxx.svg") parse error, but bitmap ("xxx.svg") works. HOT 3
- using zimjs in angular project HOT 4
- Drag make animation weird in ZIMSHIM (adobe animate) HOT 2
- please update typing definition for typescript user HOT 1
- Where is library repository? HOT 1
- Invalid redirect HOT 1
- access to plasma zapp not working HOT 1
- ZIM NPM, Vue, Svelte, React and Angular HOT 1
- ball movement with connected physics HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zimjs.