source-code/screens/circular-motion-screens/angular_kinetic_energy_screen.rb
# Draws the angular kinetic energy screen on the Shoes app window.
Draws the angular kinetic energy screen on the Shoes app window.
Draws the angular kinetic energy screen on the Shoes app window .
def angular_kinetic_energy_screen
    background('images/circular_motion_large.png')
    flow(:height => 80, :width => 1080, :scroll => false) do
      @back_button = image('images/back_icon_white.png',
                           :click => '/title_screen/circular_motion_screen')
      @heading = title('Angular kinetic energy = 0.5 x moment of inertia x angular velocity',
                       sup('2'))
      @back_button.style(@@screen_header_image_styles)
      @heading.style(@@screen_header_text_styles)
    end
    flow(:height => 640, :width => 1080, :scroll => true) do
      stack(:height => 640, :width => 80) do
      end
      stack(:height => 640, :width => 1000) do
        @heading_edited = @heading.text
        ScreenLabel.new(self, @@font, @heading_edited, 'Moment of inertia')
        flow do
          @moment_of_inertia = ScreenEditLine.new(self, @@font, @heading_edited)
          @moment_of_inertia_unit = para(strong(' kgm'), strong(sup('2')))
          @moment_of_inertia_unit.style(@@screen_unit_text_styles)
        end
        ScreenLabel.new(self, @@font, @heading_edited, 'Angular velocity')
        flow do
          @angular_velocity = ScreenEditLine.new(self, @@font, @heading_edited)
          @angular_velocity_unit = para(strong(' rads'), strong(sup('-1')))
          @angular_velocity_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.angular_kinetic_energy(@moment_of_inertia.text.to_f,
                                                    @angular_velocity.text.to_f)
            @angular_kinetic_energy = para(@result.to_s)
            @angular_kinetic_energy_unit = para(' J')
            @angular_kinetic_energy.style(@@screen_result_text_styles)
            @angular_kinetic_energy_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
def angular_kinetic_energy_screen background ( 'images/circular_motion_large.png' ) flow ( :height => 80 , :width => 1080 , :scroll => false ) do @back_button = image ( 'images/back_icon_white.png' , :click => '/title_screen/circular_motion_screen' ) @heading = title ( 'Angular kinetic energy = 0.5 x moment of inertia x angular velocity' , sup ( '2' ) ) @back_button . style ( @@screen_header_image_styles ) @heading . style ( @@screen_header_text_styles ) end flow ( :height => 640 , :width => 1080 , :scroll => true ) do stack ( :height => 640 , :width => 80 ) do end stack ( :height => 640 , :width => 1000 ) do @heading_edited = @heading . text ScreenLabel . new ( self , @@font , @heading_edited , 'Moment of inertia' ) flow do @moment_of_inertia = ScreenEditLine . new ( self , @@font , @heading_edited ) @moment_of_inertia_unit = para ( strong ( ' kgm' ) , strong ( sup ( '2' ) ) ) @moment_of_inertia_unit . style ( @@screen_unit_text_styles ) end ScreenLabel . new ( self , @@font , @heading_edited , 'Angular velocity' ) flow do @angular_velocity = ScreenEditLine . new ( self , @@font , @heading_edited ) @angular_velocity_unit = para ( strong ( ' rads' ) , strong ( sup ( '-1' ) ) ) @angular_velocity_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 . angular_kinetic_energy ( @moment_of_inertia . text . to_f , @angular_velocity . text . to_f ) @angular_kinetic_energy = para ( @result . to_s ) @angular_kinetic_energy_unit = para ( ' J' ) @angular_kinetic_energy . style ( @@screen_result_text_styles ) @angular_kinetic_energy_unit . style ( @@screen_result_text_styles ) end end end end end
Draws the angular kinetic energy screen on the Shoes app window.
Draws the angular kinetic energy screen on the Shoes app window .
# Angular kinetic energy screen header # Angular kinetic energy screen content # Left margin offset # Content column