Published
Edited
Nov 17, 2019
Insert cell
Insert cell
{
const context = initialize()
const {scene, camera, renderer, clock} = context
invalidation.then(() => renderer.dispose())
let texture = null
// The Ring or Circle geometries seemed better suited for this but the UV wasn't mapping right,
// so instead create an open ended cone and flatten it, voila!
const geometry = new THREE.ConeGeometry(100, 0, 1000, 1, true)
const material = new THREE.MeshBasicMaterial({})
const textureLoader = new THREE.TextureLoader()
const url = 'https://i.imgur.com/gBPbGlD.jpg'
// const url = 'https://i.imgur.com/7uksoUE.png'
// const url = 'https://i.imgur.com/wdc1lnw.jpg'
textureLoader.load(url, image => {
texture = image
texture.wrapS = texture.wrapT = THREE.RepeatWrapping;
texture.offset.set(0, 0)
texture.repeat.set(2, 0.5)
material.map = texture
material.needsUpdate = true
})
const mesh = new THREE.Mesh(geometry, material)
mesh.rotation.x = Math.PI / 2
scene.add(mesh)

let offset = 0
while (true) {
const speed = 0.1
const delta = clock.getDelta()
const elapsedTime = clock.getElapsedTime()
if (texture) {
offset = (offset + delta * speed) % 1
texture.offset.set(offset * 0.1, offset)
}
renderer.render(scene, camera)
yield renderer.domElement
}
}
Insert cell
Insert cell
Insert cell
Insert cell
THREE = {
const THREE = window.THREE = await require('three@0.105/build/three.min.js')
await require('three@0.105/examples/js/controls/OrbitControls.js').catch(() => {})
return THREE
}
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more