File tree Expand file tree Collapse file tree 2 files changed +9
-13
lines changed
processing_app/topics/create_shapes Expand file tree Collapse file tree 2 files changed +9
-13
lines changed Original file line number Diff line number Diff line change @@ -6,16 +6,16 @@ class Wiggler
66
77 def initialize width , height
88 @x = width /2
9- @y = height /2
9+ @y = height /2
1010 @yoff = 0
1111 # The 'original' locations of the vertices make up a circle
1212 @original = [ ]
13- ( 0 ... TAU ) . step ( 0.2 ) do |a |
14- v = PVector . from_angle ( a )
13+ ( 0 ...TAU ) . step ( 0.2 ) do |a |
14+ v = Java :: ProcessingCore :: PVector . from_angle ( a )
1515 v . mult ( 100 )
1616 original << v
1717 end
18-
18+
1919 # Now make the PShape with those vertices
2020 @s = create_shape
2121 s . begin_shape
@@ -31,11 +31,11 @@ def initialize width, height
3131 def wiggle
3232 @xoff = 0
3333 # Apply an offset to each vertex
34- ( 0 ... s . get_vertex_count ) . each do |i |
34+ ( 0 ...s . get_vertex_count ) . each do |i |
3535 # Calculate a new vertex location based on noise around 'original' location
3636 pos = original [ i ]
3737 a = TAU *noise ( xoff , yoff )
38- r = PVector . from_angle ( a )
38+ r = Java :: ProcessingCore :: PVector . from_angle ( a )
3939 r . mult ( 4 )
4040 r . add ( pos )
4141 # Set the location of each vertex to the new one
@@ -54,4 +54,3 @@ def display
5454 pop_matrix
5555 end
5656end
57-
Original file line number Diff line number Diff line change 11#
2- # WigglePShape.
2+ # WigglePShape.
33# wiggler library uses PVector, see vecmath library
44# examples to see alternative using Vec2D
55# How to move the individual vertices of a PShape
66#
77
8- load_library ' wiggler'
8+ load_library : wiggler
99
1010attr_reader :wiggler
1111
1212def setup
13- sketch_title 'Wiggle Pshape '
13+ sketch_title 'Wiggle PShape '
1414 @wiggler = Wiggler . new width , height
1515end
1616
@@ -20,9 +20,6 @@ def draw
2020 wiggler . wiggle
2121end
2222
23-
24-
2523def settings
2624 size ( 640 , 360 , P2D )
2725end
28-
You can’t perform that action at this time.
0 commit comments