Class: USPSFlags::Core::Tridents
- Inherits:
-
Object
- Object
- USPSFlags::Core::Tridents
- Defined in:
- lib/usps_flags/core/tridents.rb
Class Method Summary collapse
- .cc(type, trident_color:) ⇒ Object
- .offset(type, field_color:, field: true) ⇒ Object
- .three(type, trident_color:, field_color:) ⇒ Object
- .two(type, trident_color:, field_color:) ⇒ Object
- .vc(type, trident_color:) ⇒ Object
Class Method Details
.cc(type, trident_color:) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/usps_flags/core/tridents.rb', line 11 def cc(type, trident_color:) # The side C/C tridents are angled 45 degrees, and intersect the central one at 1/3 up from the bottom trident = USPSFlags::Core.trident(type, color: trident_color) x_distance = USPSFlags::Config::BASE_FLY * 4 / 39 y_distance = USPSFlags::Config::BASE_FLY * 5 / 78 <<~SVG <g transform="translate(-#{x_distance}, #{y_distance})"><g transform="rotate(-45, #{USPSFlags::Config::BASE_FLY / 2}, #{USPSFlags::Config::BASE_HOIST / 2})">\n#{trident}</g></g> \n#{trident} <g transform="translate(#{x_distance}, #{y_distance})"><g transform="rotate(45, #{USPSFlags::Config::BASE_FLY / 2}, #{USPSFlags::Config::BASE_HOIST / 2})">\n#{trident}</g></g> SVG end |
.offset(type, field_color:, field: true) ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/usps_flags/core/tridents.rb', line 55 def offset(type, field_color:, field: true) # Swallowtail tridents need to move towards the hoist due to the tails x_distance = USPSFlags::Config::BASE_FLY / 10 if field svg = +'' svg << "<g transform=\"translate(-#{x_distance})\">" if field svg << USPSFlags::Core.trident(type, field_color: field_color, color: :red) svg << '</g>' if field svg end |
.three(type, trident_color:, field_color:) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/usps_flags/core/tridents.rb', line 33 def three(type, trident_color:, field_color:) # Cdr and D/C tridents are spaced 1/2 the fly apart with the central one 1/4 the fly above the sides trident = USPSFlags::Core.trident(type, color: trident_color, field_color: field_color) x_distance = USPSFlags::Config::BASE_FLY / 4 y_distance = USPSFlags::Config::BASE_FLY / 16 <<~SVG <g transform="translate(-#{x_distance}, #{y_distance})">\n#{trident}</g> <g transform="translate(0, -#{y_distance + 1})">\n#{trident}</g> <g transform="translate(#{x_distance}, #{y_distance})">\n#{trident}</g> SVG end |
.two(type, trident_color:, field_color:) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/usps_flags/core/tridents.rb', line 45 def two(type, trident_color:, field_color:) # Lt/C and D/Lt/C tridents are spaced 1/3 the fly apart trident = USPSFlags::Core.trident(type, color: trident_color, field_color: field_color) x_distance = USPSFlags::Config::BASE_FLY / 6 <<~SVG <g transform="translate(-#{x_distance})">\n#{trident}</g> <g transform="translate(#{x_distance})">\n#{trident}</g> SVG end |
.vc(type, trident_color:) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/usps_flags/core/tridents.rb', line 23 def vc(type, trident_color:) # V/C tridents are angled 45 degrees, and intersect at 15/32 up from the bottom trident = USPSFlags::Core.trident(type, color: trident_color) x_distance = USPSFlags::Config::BASE_FLY * 4 / 55 <<~SVG <g transform="translate(-#{x_distance})"><g transform="rotate(-45, #{USPSFlags::Config::BASE_FLY / 2}, #{USPSFlags::Config::BASE_HOIST / 2})">\n#{trident}</g></g> <g transform="translate(#{x_distance})"><g transform="rotate(45, #{USPSFlags::Config::BASE_FLY / 2}, #{USPSFlags::Config::BASE_HOIST / 2})">\n#{trident}</g></g> SVG end |