source-code/screens/oscillations-screens/maximum_particle_speed_screen.rb
def maximum_particle_speed_screen
    @heading = 'Maximum particle speed = angular velocity x amplitude'
    background('images/oscillations_large.png')

    # Maximum particle speed screen header
    ScreenHeader.new(self, '/title_screen/oscillations_screen', @@font, @heading)

    # Maximum particle speed screen content
    flow(:height => 640, :width => 1080, :scroll => true) do
      # Left margin offset
      stack(:height => 640, :width => 80) do
      end
      # Content column
      stack(:height => 640, :width => 1000) do
        ScreenLabel.new(self, @@font, @heading, 'Angular velocity')
        flow do
          @angular_velocity = ScreenEditLine.new(self, @@font, @heading)
          @angular_velocity_unit = para(strong(' rads'), strong(sup('-1')))
          @angular_velocity_unit.style(@@screen_unit_text_styles)
        end

        ScreenLabel.new(self, @@font, @heading, 'Amplitude')
        flow do
          @amplitude = ScreenEditLine.new(self, @@font, @heading)
          @amplitude_unit = para(strong(' m'))
          @amplitude_unit.style(@@screen_unit_text_styles)
        end

        @calculate = button('Calculate')

        @result_display = flow

        @error_display = flow

        @calculate.click do
          @result_display.clear do
            @result = Joules.max_particle_speed(@angular_velocity.text.to_f,
                                                @amplitude.text.to_f)
            @maximum_particle_speed = para(@result.to_s)
            @maximum_particle_speed_unit = para(' ms', sup('-1'))
            @maximum_particle_speed.style(@@screen_result_text_styles)
            @maximum_particle_speed_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
# Draws the maximum particle speed screen on the Shoes app window.
Draws the maximum particle speed screen on the Shoes app window.
Draws the maximum particle speed screen on the Shoes app window .
def maximum_particle_speed_screen
    @heading = 'Maximum particle speed = angular velocity x amplitude'
    background('images/oscillations_large.png')
    ScreenHeader.new(self, '/title_screen/oscillations_screen', @@font, @heading)
    flow(:height => 640, :width => 1080, :scroll => true) do
      stack(:height => 640, :width => 80) do
      end
      stack(:height => 640, :width => 1000) do
        ScreenLabel.new(self, @@font, @heading, 'Angular velocity')
        flow do
          @angular_velocity = ScreenEditLine.new(self, @@font, @heading)
          @angular_velocity_unit = para(strong(' rads'), strong(sup('-1')))
          @angular_velocity_unit.style(@@screen_unit_text_styles)
        end
        ScreenLabel.new(self, @@font, @heading, 'Amplitude')
        flow do
          @amplitude = ScreenEditLine.new(self, @@font, @heading)
          @amplitude_unit = para(strong(' m'))
          @amplitude_unit.style(@@screen_unit_text_styles)
        end
        @calculate = button('Calculate')
        @result_display = flow
        @error_display = flow
        @calculate.click do
          @result_display.clear do
            @result = Joules.max_particle_speed(@angular_velocity.text.to_f,
                                                @amplitude.text.to_f)
            @maximum_particle_speed = para(@result.to_s)
            @maximum_particle_speed_unit = para(' ms', sup('-1'))
            @maximum_particle_speed.style(@@screen_result_text_styles)
            @maximum_particle_speed_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
def maximum_particle_speed_screen @heading = 'Maximum particle speed = angular velocity x amplitude' background ( 'images/oscillations_large.png' ) ScreenHeader . new ( self , '/title_screen/oscillations_screen' , @@font , @heading ) flow ( :height => 640 , :width => 1080 , :scroll => true ) do stack ( :height => 640 , :width => 80 ) do end stack ( :height => 640 , :width => 1000 ) do ScreenLabel . new ( self , @@font , @heading , 'Angular velocity' ) flow do @angular_velocity = ScreenEditLine . new ( self , @@font , @heading ) @angular_velocity_unit = para ( strong ( ' rads' ) , strong ( sup ( '-1' ) ) ) @angular_velocity_unit . style ( @@screen_unit_text_styles ) end ScreenLabel . new ( self , @@font , @heading , 'Amplitude' ) flow do @amplitude = ScreenEditLine . new ( self , @@font , @heading ) @amplitude_unit = para ( strong ( ' m' ) ) @amplitude_unit . style ( @@screen_unit_text_styles ) end @calculate = button ( 'Calculate' ) @result_display = flow @error_display = flow @calculate . click do @result_display . clear do @result = Joules . max_particle_speed ( @angular_velocity . text . to_f , @amplitude . text . to_f ) @maximum_particle_speed = para ( @result . to_s ) @maximum_particle_speed_unit = para ( ' ms' , sup ( '-1' ) ) @maximum_particle_speed . style ( @@screen_result_text_styles ) @maximum_particle_speed_unit . style ( @@screen_result_text_styles ) end end end end end
Draws the maximum particle speed screen on the Shoes app window.
Draws the maximum particle speed screen on the Shoes app window .
# Maximum particle speed screen header # Maximum particle speed screen content # Left margin offset # Content column