rfid cleanup
This commit is contained in:
parent
afd0445ed1
commit
6b5d7bec78
|
@ -70,7 +70,13 @@ async function fetchConfig(className) {
|
||||||
{ type: "color", defaultValue: "#2D81FC", property: "colour1" },
|
{ type: "color", defaultValue: "#2D81FC", property: "colour1" },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
return config[className];
|
|
||||||
|
if (className === undefined) {
|
||||||
|
return config
|
||||||
|
} else {
|
||||||
|
return config[className];
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addControl(item, instance) {
|
function addControl(item, instance) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
var seed = cyrb128("813311281");
|
var seed = cyrb128("813311281");
|
||||||
var rand = sfc32(seed[0], seed[1], seed[2], seed[3]);
|
var rand = sfc32(seed[0], seed[1], seed[2], seed[3]);
|
||||||
|
|
||||||
var gateway = `ws://192.168.20.16/ws`;
|
var gateway = `ws://192.168.20.13/ws`;
|
||||||
var websocket;
|
var websocket;
|
||||||
window.addEventListener('load', onLoad);
|
window.addEventListener('load', onLoad);
|
||||||
function initWebSocket() {
|
function initWebSocket() {
|
||||||
|
@ -32,8 +32,8 @@ function onLoad(event) {
|
||||||
initWebSocket();
|
initWebSocket();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSeed(val){
|
function setSeed(val) {
|
||||||
seed = cyrb128(val+"1");
|
seed = cyrb128(val + "1");
|
||||||
rand = sfc32(seed[0], seed[1], seed[2], seed[3]);
|
rand = sfc32(seed[0], seed[1], seed[2], seed[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,7 @@ function PRNGinRange(min = 0, max = 100) {
|
||||||
|
|
||||||
async function createShapeWithRandomProperties(inputNumber, shapeConfig) {
|
async function createShapeWithRandomProperties(inputNumber, shapeConfig) {
|
||||||
|
|
||||||
|
console.log(shapeConfig)
|
||||||
// const shapeName = Object.keys(shapeConfig)[PRNGinRange(0, Object.keys(shapeConfig).length - 1)];
|
// const shapeName = Object.keys(shapeConfig)[PRNGinRange(0, Object.keys(shapeConfig).length - 1)];
|
||||||
const shapeName = Object.keys(shapeConfig)[PRNGinRange(0, Object.keys(shapeConfig).length - 1)];
|
const shapeName = Object.keys(shapeConfig)[PRNGinRange(0, Object.keys(shapeConfig).length - 1)];
|
||||||
const ShapeClass = classMap[shapeName];
|
const ShapeClass = classMap[shapeName];
|
||||||
|
@ -155,88 +156,13 @@ async function updateDrawObj() {
|
||||||
|
|
||||||
|
|
||||||
// drawObj = createInstance(selectedShape, defaultValues);
|
// drawObj = createInstance(selectedShape, defaultValues);
|
||||||
drawObj = await createShapeWithRandomProperties(813311281, config1);
|
drawObj = await createShapeWithRandomProperties(813311281, await fetchConfig());
|
||||||
console.log(drawObj)
|
console.log(drawObj)
|
||||||
drawObj.initialise(configControls);
|
drawObj.initialise(configControls);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateDrawObj();
|
updateDrawObj();
|
||||||
const config1 = {
|
|
||||||
PolyTwistColourWidth: [
|
|
||||||
{ type: "range", min: 3, max: 10, defaultValue: 5, property: "sides" },
|
|
||||||
{ type: "range", min: 1, max: 600, defaultValue: 400, property: "width" },
|
|
||||||
{ type: "range", min: 1, max: 100, defaultValue: 50, property: "depth" },
|
|
||||||
{
|
|
||||||
type: "range",
|
|
||||||
min: -180,
|
|
||||||
max: 180,
|
|
||||||
defaultValue: -90,
|
|
||||||
property: "rotation",
|
|
||||||
},
|
|
||||||
{ type: "color", defaultValue: "#4287f5", property: "colour1" },
|
|
||||||
{ type: "color", defaultValue: "#42f57b", property: "colour2" },
|
|
||||||
],
|
|
||||||
FloralPhyllo: [
|
|
||||||
{ type: "range", min: 1, max: 600, defaultValue: 300, property: "width" },
|
|
||||||
{ type: "range", min: 1, max: 100, defaultValue: 50, property: "depth" },
|
|
||||||
{ type: "color", defaultValue: "#4287f5", property: "colour1" },
|
|
||||||
{ type: "color", defaultValue: "#4287f5", property: "colour2" },
|
|
||||||
],
|
|
||||||
Spiral1: [
|
|
||||||
{ type: "range", min: 1, max: 50, defaultValue: 20, property: "sides" },
|
|
||||||
{ type: "range", min: 1, max: 600, defaultValue: 240, property: "width" },
|
|
||||||
{ type: "color", defaultValue: "#4287f5", property: "colour" },
|
|
||||||
],
|
|
||||||
FloralAccident: [
|
|
||||||
{ type: "range", min: 1, max: 50, defaultValue: 20, property: "sides" },
|
|
||||||
{ type: "range", min: 1, max: 600, defaultValue: 240, property: "width" },
|
|
||||||
{ type: "color", defaultValue: "#4287f5", property: "colour" },
|
|
||||||
],
|
|
||||||
FloralPhyllo_Accident: [
|
|
||||||
{ type: "range", min: 1, max: 50, defaultValue: 20, property: "sides" },
|
|
||||||
{ type: "range", min: 1, max: 600, defaultValue: 240, property: "width" },
|
|
||||||
{ type: "color", defaultValue: "#2D81FC", property: "colour1" },
|
|
||||||
{ type: "color", defaultValue: "#FC0362", property: "colour2" },
|
|
||||||
],
|
|
||||||
Nodal_expanding: [
|
|
||||||
{ type: "range", min: 1, max: 100, defaultValue: 5, property: "expand" },
|
|
||||||
{ type: "range", min: 1, max: 100000, defaultValue: 100000, property: "points" },
|
|
||||||
{ type: "range", min: 1, max: 10, defaultValue: 3, property: "line_width" },
|
|
||||||
{ type: "color", defaultValue: "#2D81FC", property: "colour1" },
|
|
||||||
{ type: "color", defaultValue: "#FC0362", property: "colour2" },
|
|
||||||
{ type: "range", min: 0, max: 10, defaultValue: 5, property: "colour_change" },
|
|
||||||
],
|
|
||||||
Nodal: [
|
|
||||||
{ type: "range", min: 1, max: 1000, defaultValue: 400, property: "width" },
|
|
||||||
{ type: "range", min: 1, max: 20, defaultValue: 10, property: "points" },
|
|
||||||
{ type: "range", min: 1, max: 10, defaultValue: 3, property: "line_width" },
|
|
||||||
{ type: "range", min: 1, max: 20, defaultValue: 1, property: "step" },
|
|
||||||
{ type: "color", defaultValue: "#2D81FC", property: "colour" },
|
|
||||||
],
|
|
||||||
Phyllotaxis: [
|
|
||||||
{ type: "range", min: 1, max: 40, defaultValue: 24, property: "width" },
|
|
||||||
{ type: "range", min: 1, max: 1000, defaultValue: 300, property: "nMax" },
|
|
||||||
{ type: "color", defaultValue: "#2D81FC", property: "colour1" },
|
|
||||||
{ type: "color", defaultValue: "#FC0362", property: "colour2" },
|
|
||||||
],
|
|
||||||
SquareTwist_angle: [
|
|
||||||
{ type: "range", min: 1, max: 800, defaultValue: 400, property: "width" },
|
|
||||||
{ type: "range", min: 1, max: 10, defaultValue: 1, property: "line_width" },
|
|
||||||
{ type: "color", defaultValue: "#2D81FC", property: "colour1" },
|
|
||||||
],
|
|
||||||
rectangle_pattern1: [
|
|
||||||
{ type: "range", min: 1, max: 800, defaultValue: 400, property: "width" },
|
|
||||||
{ type: "range", min: 1, max: 100, defaultValue: 10, property: "squares" },
|
|
||||||
{ type: "range", min: 1, max: 10, defaultValue: 1, property: "line_width" },
|
|
||||||
{ type: "color", defaultValue: "#2D81FC", property: "colour1" },
|
|
||||||
],
|
|
||||||
EyePrototype: [
|
|
||||||
{ type: "range", min: 1, max: 800, defaultValue: 400, property: "width" },
|
|
||||||
{ type: "range", min: 1, max: 100, defaultValue: 10, property: "squares" },
|
|
||||||
{ type: "range", min: 1, max: 10, defaultValue: 1, property: "line_width" },
|
|
||||||
{ type: "color", defaultValue: "#2D81FC", property: "colour1" },
|
|
||||||
],
|
|
||||||
};
|
|
||||||
function render() {
|
function render() {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
|
|
|
@ -71,9 +71,7 @@ class FloralPhyllo extends BaseShape {
|
||||||
}
|
}
|
||||||
|
|
||||||
draw(angle) {
|
draw(angle) {
|
||||||
// var c = 24; //something to do with width. but not width
|
|
||||||
var c = 1; //something to do with width. but not width
|
var c = 1; //something to do with width. but not width
|
||||||
//dont make larger than 270 unless altering the number of colours in lerpedColours
|
|
||||||
for (let n = 200; n > 0; n -= 1) {
|
for (let n = 200; n > 0; n -= 1) {
|
||||||
const a = n * angle / 1000; //137.5;
|
const a = n * angle / 1000; //137.5;
|
||||||
const r = c * Math.sqrt(n);
|
const r = c * Math.sqrt(n);
|
||||||
|
@ -169,7 +167,6 @@ class FloralPhyllo_Accident extends BaseShape {
|
||||||
var c = 24; //something to do with width. but not width
|
var c = 24; //something to do with width. but not width
|
||||||
|
|
||||||
for (let n = 0; n < 300; n += 1) {
|
for (let n = 0; n < 300; n += 1) {
|
||||||
let ncolour = LerpHex(this.colour1, this.colour2, Math.cos(rad(n / 2)));
|
|
||||||
let a = n * (angle / 1000 + 100); //137.5;
|
let a = n * (angle / 1000 + 100); //137.5;
|
||||||
let r = c * Math.sqrt(n);
|
let r = c * Math.sqrt(n);
|
||||||
let x = r * Math.cos(a) + centerX;
|
let x = r * Math.cos(a) + centerX;
|
||||||
|
@ -195,9 +192,6 @@ class Nodal_expanding extends BaseShape {
|
||||||
let colour_change = this.colour_change / 10
|
let colour_change = this.colour_change / 10
|
||||||
var angle = 360 / this.points * step
|
var angle = 360 / this.points * step
|
||||||
|
|
||||||
var start_angle = angle;
|
|
||||||
var done = false;
|
|
||||||
var total_moves = 1;
|
|
||||||
var length = this.expand;
|
var length = this.expand;
|
||||||
|
|
||||||
for (let z = 1; z <= 100; z++) { //why specifically 2500
|
for (let z = 1; z <= 100; z++) { //why specifically 2500
|
||||||
|
@ -210,7 +204,6 @@ class Nodal_expanding extends BaseShape {
|
||||||
ctx.lineWidth = this.line_width;//try 1
|
ctx.lineWidth = this.line_width;//try 1
|
||||||
ctx.strokeStyle = ncolour;
|
ctx.strokeStyle = ncolour;
|
||||||
// ctx.strokeStyle = colourToText(ncolour);
|
// ctx.strokeStyle = colourToText(ncolour);
|
||||||
console.log(ncolour)
|
|
||||||
ctx.stroke();
|
ctx.stroke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue