Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import randomVec3 from 'gl-vec3/random'
import triangleCentroid from 'triangle-centroid'
import reindex from 'mesh-reindex'
import unindex from 'unindex-mesh'
import shuffle from 'array-shuffle'
import svgMesh3d from '../'
const createGeom = require('three-simplicial-complex')(THREE)
const fs = require('fs')
const tweenr = Tweenr({ defaultEase: 'expoOut' })
const vertShader = fs.readFileSync(__dirname + '/vert.glsl', 'utf8')
const fragShader = fs.readFileSync(__dirname + '/frag.glsl', 'utf8')
let files = fs.readdirSync(__dirname + '/svg/entypo-social')
.filter(file => /\.svg$/.test(file))
files = shuffle(files)
document.querySelector('.count').innerText = files.length
const canvas = document.querySelector('canvas')
canvas.addEventListener('touchstart', (ev) => ev.preventDefault())
canvas.addEventListener('contextmenu', (ev) => ev.preventDefault())
const renderer = new THREE.WebGLRenderer({
canvas: canvas,
antialias: true,
devicePixelRatio: window.devicePixelRatio
})
renderer.setClearColor(0x97c2c5, 1)
const scene = new THREE.Scene()
const camera = new THREE.PerspectiveCamera(50, 1, 0.01, 100)
const render = compose(({ props, dispatch }) => {
const countries = shuffle([ ...props.countries ]);
const answers = [ props.country.capital, ...countries.filter(x => x.name !== props.country.name).slice(0, MAXIMUM_CHOICES - 1).map(x => x.capital) ];
const sendAnswer = compose(() => dispatch(fetchCountry()), name => dispatch(setAnswer(name)));
return (
<section>
{ props.country.name && `What is the capital of ${props.country.name}?` }
<ul>
{answers.map(name => {
return (
<li name=""> sendAnswer(name)}>
{name}
</li></ul></section>