zoomoid / demo-man Goto Github PK
View Code? Open in Web Editor NEWdemo-man provides your listeners with fresh tunes with just a PUT of a button
License: MIT License
demo-man provides your listeners with fresh tunes with just a PUT of a button
License: MIT License
The API responds with an HTTP 500 Error without further details in the logs. Need to investigate on that.
SVG rectangles are largely templatable and also require configuration files to be present.
As we mount the config files into the container using Kubernetes, we provide default configurations for usage outside of Kubernetes or without a proper ConfigMap.
The config files are JSON data which nodeJS can read directly using require / import, hence we do not need to emply JSON readers.
A example config map looks like this:
apiVersion: v1
kind: ConfigMap
metadata:
name: demo-wave-man-config
namespace: web
labels:
app: demo-man
svc: wave-man
data:
small.json: |
{
"step_width": 16,
"height": 200,
"color": "{{.color}}",
"rounded": 8,
"steps": 32,
"gap": 7,
"mode": "rounded_avg",
"align": "center",
"sr": 48000,
"mono": true,
"scale": 1,
"dpi": 600,
"preserveAspectRatio": "none"
}
full.json: |
{
"step_width": 20,
"height": 200,
"color": "{{.color}}",
"rounded": 10,
"steps": 64,
"gap": 4,
"mode": "rounded_avg",
"align": "center",
"sr": 48000,
"mono": true,
"scale": 1,
"dpi": 600,
"preserveAspectRatio": "none"
}
Note that the color property is used to template the color such that the API server can replace the escape string with whatever color the user requests.
Most information for the actual rectangles can be derived from the config map.
The rendering logic for the SVG rectangles should look roughly like this:
x := i * config.step_width
y := (1 - chunk) * config.height
, while for center mode, the Y position is y := (0.5 * config.height) - (0.5 * chunk * config.height)
, as we need to center the rectangle in the canvas.width := config.step_width - config.gap
height := config.height * chunk
After this, append the rectangle to the SVG string already constructed.
Packages needed at least:
This time, we construct the SVG by hand, therefore, we do not need a package to create a canvas and add elements to it,
as we only create primitive rectangles with incremental x values
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.