UNPKG

kitchen-simulator

Version:

It is a kitchen simulator (self-contained micro-frontend).

27 lines 1.09 kB
import * as Three from 'three'; import { List } from 'immutable'; import { COLORS } from "../../../shared-style"; export default function (width, height, grid, font) { var step = grid.properties.get('step'); var colors = grid.properties.has('color') ? new List([grid.properties.get('color')]) : grid.properties.get('colors'); var streak = new Three.Object3D(); streak.name = 'streak'; var counter = 0; for (var i = 0; i <= height; i += step) { for (var j = 0; j <= width; j += step) { var geometry = new Three.BufferGeometry(); geometry.setAttribute('position', new Three.BufferAttribute(new Float32Array([0, 0, -i, width, 0, -i]), 3)); var color = colors.get(counter % colors.size); var material = new Three.LineBasicMaterial({ color: color }); var circlegeometry = new Three.CircleGeometry(3, 32); // 3D dot's radius var circle = new Three.Mesh(circlegeometry, material); circle.rotation.x -= Math.PI / 2; circle.position.set(j, -0.5, -i); streak.add(circle); counter++; } } return streak; }