source-code/screens/waves_screen.rb
# Draws the waves screen on the Shoes app window.
Draws the waves screen on the Shoes app window.
Draws the waves screen on the Shoes app window .
def waves_screen
    @heading = 'Waves'
    @heading_edited = @heading.downcase.gsub(/[,&]/,'').squeeze(' ').gsub(' ','_')
    background("images/#{@heading_edited}_large.png")
    ScreenHeader.new(self, '/title_screen', @@font, @heading)
    flow(:height => 640, :width => 1080, :scroll => true) do
      stack(:height => 1150, :width => 80) do
      end
      stack(:height => 1150, :width => 1000) do
        @formula_set =
          {'Wave speed' => 'Wave speed = frequency x wavelength',
           'Wavelength' => 'Wavelength = wave speed / frequency',
           'Frequency v1' => 'Frequency = wave speed / wavelength',
           'Frequency v2' => 'Frequency = 1 / time period',
           'Time period v1' => 'Time period = 1 / frequency',
           'Intensity' => 'Intensity = power / area',
           'Refractive index v1' => 'Refractive index = sine(angle of incidence) / sine(angle of refraction)',
           'Refractive index v2' => 'Refractive index = 1 / sine(critical angle)',
           'Magnification' => 'Magnification = image height / object height',
           'Focal length' => 'Focal length = 1 / ((1 / object_distance) + (1 / image_distance))',
           'Power of lens' => 'Power of lens = 1 / focal length'}
        @formula_set.each do |name, formula|
          ScreenBox.new(self, @@theme_colour, @@font, @heading, formula, name)
        end
      end
    end
  end
def waves_screen @heading = 'Waves' @heading_edited = @heading . downcase . gsub ( / [,&] / , '' ) . squeeze ( ' ' ) . gsub ( ' ' , '_' ) background ( "images/#{@heading_edited}_large.png" ) ScreenHeader . new ( self , '/title_screen' , @@font , @heading ) flow ( :height => 640 , :width => 1080 , :scroll => true ) do stack ( :height => 1150 , :width => 80 ) do end stack ( :height => 1150 , :width => 1000 ) do @formula_set = { 'Wave speed' => 'Wave speed = frequency x wavelength' , 'Wavelength' => 'Wavelength = wave speed / frequency' , 'Frequency v1' => 'Frequency = wave speed / wavelength' , 'Frequency v2' => 'Frequency = 1 / time period' , 'Time period v1' => 'Time period = 1 / frequency' , 'Intensity' => 'Intensity = power / area' , 'Refractive index v1' => 'Refractive index = sine(angle of incidence) / sine(angle of refraction)' , 'Refractive index v2' => 'Refractive index = 1 / sine(critical angle)' , 'Magnification' => 'Magnification = image height / object height' , 'Focal length' => 'Focal length = 1 / ((1 / object_distance) + (1 / image_distance))' , 'Power of lens' => 'Power of lens = 1 / focal length' } @formula_set . each do | name , formula | ScreenBox . new ( self , @@theme_colour , @@font , @heading , formula , name ) end end end end
Draws the waves screen on the Shoes app window.
Draws the waves screen on the Shoes app window .
# Waves screen header # Waves screen content # Left margin offset # Content column