Skip to content

Commit d12b78a

Browse files
committed
moar data_path fixes
1 parent 70dfa23 commit d12b78a

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

processing_app/topics/file_io/load_file.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# pair of numbers is loaded each frame and used to draw a point on the screen.
77
class LoadFile < Propane::App
88
attr_reader :points, :count
9-
X, Y = 0, 1
109

1110
def setup
1211
sketch_title 'Load File1'
@@ -18,14 +17,14 @@ def setup
1817
@points = []
1918
# The use of vanilla processing load_strings convenience method is
2019
# of dubious value in ruby processing when you can do this
21-
File.open('data/positions.txt').each_line do |line|
22-
points << line.split(/\t/).map! { |i| i.to_i * 2 }
20+
File.open(data_path('positions.txt')).each_line do |line|
21+
points << line.split.map! { |i| i.to_i * 2 }
2322
end
2423
end
2524

2625
def draw
2726
return unless count < points.size
28-
point(points[count][X], points[count][Y])
27+
point(*points[count])
2928
@count += 1
3029
end
3130

processing_app/topics/file_io/save_frames.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ class SaveFrames < Propane::App
1414
def setup
1515
sketch_title 'Save Frames'
1616
@recording = false
17-
directory = 'output'
18-
Dir.mkdir(directory) unless File.exist?(directory)
1917
end
2018

2119
def draw
@@ -30,14 +28,10 @@ def draw
3028
line(-100, 0, 100, 0)
3129
pop_matrix
3230
end
33-
34-
# If we are recording call saveFrame!
35-
# The number signs (#) indicate to Processing to
36-
# number the files automatically
37-
save_frame(data_path('frames####.png')) if recording
31+
# The '#' symbols makes Processing number the files automatically
32+
save_frame(data_path('output/frames####.png')) if recording
3833
# Let's draw some stuff to tell us what is happening
39-
# It's important to note that none of this will show up in the
40-
# rendered files b/c it is drawn *after* saveFrame
34+
# NB: Content created after this line does not show up rendered files
4135
text_align(CENTER)
4236
fill(255)
4337
if !recording

0 commit comments

Comments
 (0)