not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

40 lines
1.5 KiB

clearScreen ('black')
center = { 'x': window.innerWidth / 2,
'y': window.innerHeight / 2 }
class Mandala:
def __init__(self, text, freq=1, dist=0, \
font_size=32, color='black', \
font='"Noto Mono", "Noto Emoji"', offset=0):
self.text = text
rad = 360/freq * (Math.PI/180)
for i in range(freq):
angle = i * rad - offset
pos = { 'x': Math.cos(angle - Math.PI/2) * dist,
'y': Math.sin(angle - Math.PI/2) * dist }
self.place(pos, angle, font_size, font, color)
def place(self, pos, rad, font_size, font, color):
el = document.createElement('span')
el.innerHTML = self.text
el.style['text-shadow'] = '0 0 10px white'
el.style['color'] = color
el.style['font-size'] = font_size + 'px'
el.style['font-family'] = font
el.style['position'] = 'absolute'
el.style.transform = 'rotate(' + rad + 'rad)'
document.body.appendChild(el)
style = window.getComputedStyle(el)
offset_x = int(style.width) / 2
offset_y = int(style.height) / 2
el.style.top = center.y + pos.y - offset_y + 'px'
el.style.left = center.x + pos.x - offset_x + 'px'
if __name__=='__main__':
Mandala ('🌺', 20, 295, 90, 'pink')
Mandala ('🍎', 22, 220, 60, 'red')
Mandala ('🐜', 20, 160, 50, 'orange')
Mandala ('🐌', 10, 110, 30, 'green')
Mandala ('Azúcar', 6, 70, 18, 'yellow')
Mandala ('Somos', 2, 20, 30, 'blue')