source-code/screens/oscillations-screens/particle_acceleration_screen.rb
def particle_acceleration_screen
    background('images/oscillations_large.png')

    # Particle acceleration screen header
    flow(:height => 80, :width => 1080, :scroll => false) do
      @back_button = image('images/back_icon_white.png',
                           :click => '/title_screen/oscillations_screen')
      @heading = title('Particle acceleration = - (angular velocity', sup('2'),
                       ' x displacement)')
      @back_button.style(@@screen_header_image_styles)
      @heading.style(@@screen_header_text_styles)
    end

    # Particle acceleration 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
        @heading_edited = @heading.text
        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

        ScreenLabel.new(self, @@font, @heading_edited, 'Displacement')
        flow do
          @displacement = ScreenEditLine.new(self, @@font, @heading_edited)
          @displacement_unit = para(strong(' m'))
          @displacement_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.particle_acceleration(@angular_velocity.text.to_f,
                                                   @displacement.text.to_f)
            @particle_acceleration = para(@result.to_s)
            @particle_acceleration_unit = para(' ms', sup('-2'))
            @particle_acceleration.style(@@screen_result_text_styles)
            @particle_acceleration_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
# Draws the particle acceleration screen on the Shoes app window.
Draws the particle acceleration screen on the Shoes app window.
Draws the particle acceleration screen on the Shoes app window .
def particle_acceleration_screen
    background('images/oscillations_large.png')
    flow(:height => 80, :width => 1080, :scroll => false) do
      @back_button = image('images/back_icon_white.png',
                           :click => '/title_screen/oscillations_screen')
      @heading = title('Particle acceleration = - (angular velocity', sup('2'),
                       ' x displacement)')
      @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, '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
        ScreenLabel.new(self, @@font, @heading_edited, 'Displacement')
        flow do
          @displacement = ScreenEditLine.new(self, @@font, @heading_edited)
          @displacement_unit = para(strong(' m'))
          @displacement_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.particle_acceleration(@angular_velocity.text.to_f,
                                                   @displacement.text.to_f)
            @particle_acceleration = para(@result.to_s)
            @particle_acceleration_unit = para(' ms', sup('-2'))
            @particle_acceleration.style(@@screen_result_text_styles)
            @particle_acceleration_unit.style(@@screen_result_text_styles)
          end
        end
      end
    end
  end
def particle_acceleration_screen background ( 'images/oscillations_large.png' ) flow ( :height => 80 , :width => 1080 , :scroll => false ) do @back_button = image ( 'images/back_icon_white.png' , :click => '/title_screen/oscillations_screen' ) @heading = title ( 'Particle acceleration = - (angular velocity' , sup ( '2' ) , ' x displacement)' ) @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 , '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 ScreenLabel . new ( self , @@font , @heading_edited , 'Displacement' ) flow do @displacement = ScreenEditLine . new ( self , @@font , @heading_edited ) @displacement_unit = para ( strong ( ' m' ) ) @displacement_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 . particle_acceleration ( @angular_velocity . text . to_f , @displacement . text . to_f ) @particle_acceleration = para ( @result . to_s ) @particle_acceleration_unit = para ( ' ms' , sup ( '-2' ) ) @particle_acceleration . style ( @@screen_result_text_styles ) @particle_acceleration_unit . style ( @@screen_result_text_styles ) end end end end end
Draws the particle acceleration screen on the Shoes app window.
Draws the particle acceleration screen on the Shoes app window .
# Particle acceleration screen header # Particle acceleration screen content # Left margin offset # Content column