$('#toggle').click ( function() {
motion = !motion;
console.log (motion)
});
var camera, scene, renderer, circle, radius ;
var mouse = new THREE.Vector2();
var raycaster = new THREE.Raycaster();
var rectangle = new THREE.Mesh(new THREE.PlaneGeometry(20, 20), new THREE.MeshBasicMaterial());
var pickables = [];
var pos, vel;
var motion = true;
init();
animate();
function init() {
var ww = $("#container").innerWidth();
var hh = $("#container").innerHeight();
renderer = new THREE.WebGLRenderer();
renderer.setSize(ww, hh);
renderer.setClearColor(0x888888);
$("#container").append(renderer.domElement);
////////////////////////////////////////////////
scene = new THREE.Scene();
scene.add(rectangle);
camera = new THREE.OrthographicCamera (-50,50,50,-50,1, 1000);
camera.position.z = 500;
var gridXY = new THREE.GridHelper(200, 20, 'red', 'white');
scene.add(gridXY);
let plane1 = new THREE.Mesh(new THREE.PlaneGeometry(200, 200), new THREE.MeshBasicMaterial({
transparent: true,
opacity: 0.1,
visible: true,
color: 0x0000ff
}));
scene.add(plane1);
pickables.push(plane1);
radius = 5;
circle = new THREE.Mesh (new THREE.CircleGeometry (radius,20), new THREE.MeshBasicMaterial());
scene.add (circle);
let geometry = new THREE.Geometry();
geometry.vertices.push(
new THREE.Vector3(-40, -40, 0),
new THREE.Vector3(40, -40, 0),
new THREE.Vector3(40, 40, 0),
new THREE.Vector3(-40, 40, 0),
new THREE.Vector3(-40, -40, 0));
let border = new THREE.Line(geometry, new THREE.LineBasicMaterial({
color: 0x0000ff
}));
scene.add(border);
pos = new THREE.Vector3();
vel = new THREE.Vector3(5,4,0);
window.addEventListener('resize', onWindowResize, false);
window.addEventListener('mousedown', onDocumentMouseDown, false);
}
function onWindowResize() {
var ww = $("#container").innerWidth();
var hh = $("#container").innerHeight();
camera.aspect = ww / hh;
...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.