Replies: 3 comments 6 replies
-
I believe you can create a SVG (or PDF) sequence like this: import py5
def setup():
py5.size(500, 500, py5.SVG, 'out_####.svg')
def draw():
# draw stuff
if py5.frame_count == 10:
py5.exit_sketch() That would save 10 SVG files. Can you give that a try? I believe you can also use the record functionality with a filename like |
Beta Was this translation helpful? Give feedback.
-
Can you code something for that using the record functionality? Only record when a certain flag has been set? Another approach is to save everything but delete what you don't want. |
Beta Was this translation helpful? Give feedback.
-
This "accumulated frames saved example" works fine with PDF, but not with SVG, any insights, @hx2A ? I found in some previous notes that this was only possible with PDF, I think I'm going to "write off" this as a SVG export limitation (and warn in my teaching materials). fator_escala = 10
salvar_svg = False
def setup():
size(200, 200) # 2000px x 2000px with scale factor 10
def draw():
if salvar_svg:
svg_output.scale(fator_escala)
fill(255, 32)
if is_mouse_pressed:
circle(mouse_x, mouse_y, width / 10)
def key_pressed():
global salvar_svg, file_name, svg_output
if key == 'r': # 'r' starts and stops recording
if not salvar_svg:
salvar_svg = True
background(200) # screen only
file_name = f'{frame_count}.svg'
svg_output = create_graphics(
width * fator_escala, height * fator_escala, SVG, file_name)
begin_record(svg_output)
else:
salvar_svg = False
end_record() |
Beta Was this translation helpful? Give feedback.
-
When we discussed this issue (#137) ...UPDATE: I tried to save two files with
begin_record
/end_record
in two different frames but it looks like I made some mistake ... so I started thinking it wouldn't work because I was missing theexit_sketch()
(which in fact is only necessary when usingSVG
as asize()
renderer argument).Everything works as it used to in Processing Python mode...
Beta Was this translation helpful? Give feedback.
All reactions