Skip to content

Commit 05f56fd

Browse files
author
Jason Long
committed
Merge pull request #32 from p-lambert/random-pattern
Random pattern
2 parents 145285b + bd05c7d commit 05f56fd

File tree

2 files changed

+0
-49
lines changed

2 files changed

+0
-49
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ You can then use this string to set the background:
9090

9191
![](http://jasonlong.github.io/geo_pattern/examples/triangles.png)
9292

93-
### triangles_rotated
94-
95-
![](http://jasonlong.github.io/geo_pattern/examples/triangles_rotated.png)
96-
9793
### squares
9894

9995
![](http://jasonlong.github.io/geo_pattern/examples/squares.png)

lib/geo_pattern/pattern.rb

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ class Pattern
2424
tessellation
2525
nested_squares
2626
mosaic_squares
27-
triangles_rotated
2827
chevrons
2928
].freeze
3029

@@ -538,50 +537,6 @@ def geo_triangles
538537
end
539538
end
540539

541-
def geo_triangles_rotated
542-
scale = hex_val(0, 1)
543-
side_length = map(scale, 0, 15, 15, 80)
544-
triangle_width = side_length/2 * Math.sqrt(3)
545-
triangle = build_rotated_triangle_shape(side_length, triangle_width)
546-
547-
svg.set_width(triangle_width * 6)
548-
svg.set_height(side_length * 3)
549-
550-
i = 0
551-
for y in 0..5
552-
for x in 0..5
553-
val = hex_val(i, 1)
554-
opacity = opacity(val)
555-
fill = fill_color(val)
556-
557-
styles = {
558-
"fill" => fill,
559-
"fill-opacity" => opacity,
560-
"stroke" => STROKE_COLOR,
561-
"stroke-opacity" => STROKE_OPACITY
562-
}
563-
564-
rotation = ""
565-
if y % 2 == 0
566-
rotation = x % 2 == 0 ? 180 : 0
567-
else
568-
rotation = x % 2 != 0 ? 180 : 0
569-
end
570-
571-
svg.polyline(triangle, styles.merge({
572-
"transform" => "translate(#{triangle_width*x}, #{y*side_length*0.5 - side_length/2}) rotate(#{rotation}, #{triangle_width/2}, #{side_length/2})"}))
573-
574-
# Add an extra one at top-right, for tiling.
575-
if (y == 0)
576-
svg.polyline(triangle, styles.merge({
577-
"transform" => "translate(#{triangle_width*x}, #{6*side_length*0.5 - side_length/2}) rotate(#{rotation}, #{triangle_width/2}, #{side_length/2})"}))
578-
579-
end
580-
i += 1
581-
end
582-
end
583-
end
584-
585540
def geo_diamonds
586541
diamond_width = map(hex_val(0, 1), 0, 15, 10, 50)
587542
diamond_height = map(hex_val(1, 1), 0, 15, 10, 50)

0 commit comments

Comments
 (0)