@@ -12,11 +12,11 @@ def setup
1212 sketch_title 'Physics Type'
1313 @input = 'Hello!'
1414 RG . init ( self )
15- fnt = RG . loadFont ( 'ReplicaBold.ttf' ) # file name
16- RG . textFont ( fnt , 330 ) # RFont object, size
17- @font = RG . getText ( input ) # String to RShape
18- RG . setPolygonizer ( RCommand ::UNIFORMLENGTH )
19- RG . setPolygonizerLength ( 10 ) # length of segment
15+ fnt = RG . load_font ( 'ReplicaBold.ttf' ) # file name
16+ RG . text_font ( fnt , 330 ) # RFont object, size
17+ @font = RG . get_text ( input ) # String to RShape
18+ RG . set_polygonizer ( RCommand ::UNIFORMLENGTH )
19+ RG . set_polygonizer_length ( 10 ) # length of segment
2020 init_physics
2121 fill ( 255 )
2222end
@@ -40,16 +40,16 @@ def init_physics
4040 # add gravity along positive Y axis
4141 physics . add_behavior ( Physics ::GravityBehavior2D . new ( TVec2D . new ( 0 , 0.1 ) ) )
4242 # multidimensional array of x and y coordinates
43- paths = font . get_points_in_paths
43+ paths = font . get_points_in_paths
4444 offset = TVec2D . new ( 200 , 250 )
45- return if ( paths . nil? )
45+ return if paths . nil?
4646 paths . length . times do |ii |
4747 points = paths [ ii ]
4848 path_particles = [ ]
4949 points . length . times do |i |
5050 p = Physics ::VerletParticle2D . new (
51- points [ i ] . x + offset . x ,
52- points [ i ] . y + offset . y
51+ points [ i ] . x + offset . x ,
52+ points [ i ] . y + offset . y
5353 )
5454 physics . addParticle ( p )
5555 path_particles << p
@@ -64,11 +64,11 @@ def init_physics
6464 end
6565 first = path_particles . first
6666 last = path_particles . last
67- physics . addSpring (
67+ physics . add_spring (
6868 Physics ::VerletSpring2D . new (
6969 first ,
7070 last ,
71- first . distanceTo ( last ) ,
71+ first . distance_to ( last ) ,
7272 1
7373 )
7474 )
0 commit comments