first commit
This commit is contained in:
commit
67eb7fa315
13 changed files with 943 additions and 0 deletions
36
ascii_writer/repeated_sinus.py
Normal file
36
ascii_writer/repeated_sinus.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
from asciiWriter.patterns import sinus_vertical
|
||||
from asciiWriter.utils import make_lines, visit, print_lines, merge
|
||||
from asciiWriter.marks import sentence, space
|
||||
|
||||
# Define width and height of the output
|
||||
width = 80
|
||||
height = 70
|
||||
|
||||
# As we draw multiple sinoids we will collect
|
||||
# them in a list of layers
|
||||
layers = []
|
||||
|
||||
# Loop through an offset from -40 to 40 in steps of 10
|
||||
for x in range(-40, 40, 10):
|
||||
# Set the pattern with the changing offset
|
||||
pattern = sinus_vertical(period=40, amplitude=40, offset=x)
|
||||
# We use a sentence to draw the text
|
||||
mark = sentence('convivialité ')
|
||||
# Define a blank character
|
||||
blank = space()
|
||||
|
||||
# Make the canvas
|
||||
lines = make_lines(width, height)
|
||||
|
||||
# Draw the sinoid, but add it to the list
|
||||
result = visit(lines, pattern, mark, blank)
|
||||
# Add it the result to the list of layers
|
||||
layers.append(result)
|
||||
|
||||
# Merge the layers into one layer again
|
||||
merged = merge(width, height, blank(), layers)
|
||||
|
||||
# Print the result
|
||||
print_lines(merged)
|
||||
Loading…
Add table
Add a link
Reference in a new issue