Sha256: 7aca6eabe1ca2c5d1927ff7dd18290ab79587894adcf869a3fa9fac1dea21926

Contents?: true

Size: 1.25 KB

Versions: 1

Compression:

Stored size: 1.25 KB

Contents

module Belajar
  module Views

    class Splash
      include Views

      def initialize
        title = "BELAJAR"
        subtitle = "Learning the Ruby programming language dead easy."

        panel = default_window

        lines.times do |line|
          panel.setpos(line, 0)
          panel.red(' ' * cols, Curses::A_STANDOUT)
        end

        panel.setpos((lines / 4), (cols - title.length) / 2)
        panel.red(title, Curses::A_STANDOUT)
        panel.refresh

        sleep 0.5

        ruby_ascii_art.each_with_index do |line, index|
          panel.setpos(lines / 4 + 2 + index, (cols - line.length) / 2)
          panel.red(line, Curses::A_STANDOUT)
          sleep 0.06
          panel.refresh
        end

        panel.setpos(lines / 4 + 11, (cols - subtitle.length) / 2)

        subtitle.chars do |char|
          panel.red(char, Curses::A_STANDOUT)
          panel.refresh
          sleep 0.02
        end

        sleep 2.5

        close_screen
      end

      def ruby_ascii_art
        [
            "  ___________  ",
            " /.\\  /.\\  /.\\ ",
            "/___\\/___\\/___\\",
            " \\  \\  . / . / ",
            "   \\ \\ ./ ./   ",
            "    \\\\ / /    ",
            "      \\./     "
        ]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
belajar-0.1.1 lib/belajar/views/splash.rb