Skip to content

Commit 261ac9e

Browse files
committed
reafacto f_agent and font_agent to library
1 parent 46abd72 commit 261ac9e

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

external_library/gem/geomerative/font_agent.rb renamed to external_library/gem/geomerative/library/font_agent/font_agent.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def initialize(location:)
1212
def motion
1313
noise_scale = map1d(mouse_x, (0..width), (0.001..0.01))
1414
noise_z = map1d(mouse_x, (0..height), (frame_count * 0.0003..frame_count * 0.02))
15-
@mot = noise(loc.x * noise_scale * noise_z, loc.y * noise_scale * noise_z) * 53
15+
noise_vector = loc * noise_scale * noise_z
16+
@mot = noise(noise_vector.x, noise_vector.y) * 53
1617
end
1718

1819
def display(step:)

external_library/gem/geomerative/typo_deform.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/usr/bin/env jruby -w
2+
3+
24
require 'propane'
35
require 'geomerative'
4-
require_relative 'font_agent'
56

67
# --------- GEOMERATIVE EXAMPLES ---------------
78
# //////////////////////////////////////////////
@@ -26,6 +27,7 @@
2627
# www.freeartbureau.org/blog
2728
#
2829
class Deform < Propane::App
30+
load_library :font_agent
2931
attr_reader :my_font, :my_group, :my_points, :my_text
3032
attr_reader :my_agents, :step, :stop_anime
3133

@@ -44,7 +46,7 @@ def setup
4446
RCommand.setSegmentLength(10)
4547
RCommand.setSegmentator(RCommand::UNIFORMLENGTH)
4648
@my_points = my_font.toGroup(my_text).getPoints
47-
@my_agents = my_points.map { |point| FontAgent.new(location: Vec2D.new(point.x, point.y)) }
49+
@my_agents = my_points.map { |point| FontAgent.new(location: Vec2D.new(point)) }
4850
end
4951

5052
def draw

external_library/gem/geomerative/typo_extra_bright.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env jruby -w
22
require 'propane'
33
require 'geomerative'
4-
require_relative 'f_agent'
4+
55
# --------- GEOMERATIVE EXAMPLES ---------------
66
# //////////////////////////////////////////////
77
# Title : TypoGeo_ExtraBright
@@ -24,6 +24,7 @@
2424
# www.freeartbureau.org/blog
2525
# translated for propane by Martin Prout
2626
class ExtraBright < Propane::App
27+
load_library :f_agent
2728
attr_reader :my_agents
2829

2930
def settings
@@ -42,7 +43,7 @@ def setup
4243
RCommand.set_segmentator(RCommand::UNIFORMLENGTH)
4344
@my_agents = my_font.to_group(my_text).get_points.map do |point|
4445
FontAgent.new(
45-
loc: Vec2D.new(point.x, point.y),
46+
loc: Vec2D.new(point),
4647
increment: Vec2D.new(x_incr, y_incr)
4748
)
4849
end

0 commit comments

Comments
 (0)