Skip to content

Commit

Permalink
Allow to add an angle for each layer
Browse files Browse the repository at this point in the history
  • Loading branch information
Naveduran committed Oct 25, 2024
1 parent eef1536 commit 6f4e3f3
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 347 deletions.
68 changes: 41 additions & 27 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const initialConfig = {
strokeWidth: 1,
angle: 0
},

{
name:'Circle 1',
strokeWidth: 0,
Expand Down Expand Up @@ -182,48 +183,61 @@ const initialConfig = {
]
}

// The default layer when a new layer adding is required
const oneLayer = {
name:'Three gray circles',
strokeColor: null,
fillColor: 'hsla(0, 6%, 48%, 0.48)',
figureName: 'circle',
total: 3,
radius: 30,
distance: 90,
visibility: 0,
angle: 0
}

// Contains the figures name with its correspondent function
const figures = {
'line': function lines(layer){
'line': function liness(layer){
for (line=0; line < layer.total; line++){
let angle = (360 /layer.total)*line;
let angle = (360 /layer.total) * line + layer.angle;
try {
polarLine(angle, layer.radius, layer.distance);
} catch (error) {
console.error(error);
}
}
},
'circle': function circles(layer){
try {
polarEllipses(layer.total, layer.radius, layer.radius, layer.distance);
} catch (error) {
console.error(error);
'circle': function circless(layer){
for (circle=0; circle < layer.total; circle++){
let angle = (360 /layer.total) * circle + layer.angle;
try {
polarEllipse(angle, layer.radius, layer.radius, layer.distance)
} catch (error) {
console.error(error);
}
}

},
'triangle': function triangle(layer){
try {
polarTriangles(layer.total, layer.radius, layer.distance);
} catch (error) {
console.error(error);
'triangle': function triangless(layer){
for (circle=0; circle < layer.total; circle++){
let angle = (360 /layer.total) * circle + layer.angle;
try {
polarTriangle(angle, layer.radius, layer.distance)
} catch (error) {
console.error(error);
}
}
},
'square': function square(layer){
try {
polarPolygons(layer.total, 4, layer.radius, layer.distance)
} catch (error) {
console.error(error);
'square': function squaress(layer){
for (circle=0; circle < layer.total; circle++){
let angle = (360 /layer.total) * circle + layer.angle;
try {
polarPolygon(4, angle, layer.radius, layer.distance)
} catch (error) {
console.error(error);
}
}
}
}

const oneLayer = {
name:'Lines',
strokeColor: null,
fillColor: 'hsla(0, 6%, 48%, 0.48)',
figureName: 'circle',
total: 3,
radius: 30,
distance: 90,
visibility: 0
}
Loading

0 comments on commit 6f4e3f3

Please sign in to comment.