Class: Bestguigui::SplashGem
- Inherits:
-
Object
- Object
- Bestguigui::SplashGem
- Defined in:
- lib/bestguigui_lab/splash_scene.rb
Overview
Le rubis animé du splash screen : tombe du haut de l'écran, touche le titre, rebondit au-dessus, puis se stabilise. Dessiné en primitives Gosu (aucune image).
Constant Summary collapse
- SIZE =
220- GAP =
40- OVERSHOOT =
12- FALL =
0.5
- BOUNCE_UP =
0.25
- SETTLE =
0.2
- IMPACT_DIP =
10- POINTS =
Points du diamant, en fractions (0..1) d'une boîte carrée.
{ tl: [0.30, 0.32], tr: [0.70, 0.32], l: [0.12, 0.45], r: [0.88, 0.45], hub: [0.50, 0.47], bottom: [0.50, 0.88] }.freeze
- HIGHLIGHT =
[240, 150, 155].freeze
- BASE =
[210, 90, 95].freeze
- DARK =
[180, 60, 65].freeze
- OUTLINE_RGB =
[40, 30, 40].freeze
- FACETS =
[ [i[tl hub l], HIGHLIGHT], [i[tl tr hub], BASE], [i[tr r hub], DARK], [i[l hub bottom], HIGHLIGHT], [i[r bottom hub], DARK] ].freeze
- OUTLINE =
i[tl tr r bottom l].freeze
Instance Method Summary collapse
- #draw(elapsed, alpha) ⇒ Object
-
#initialize(window) ⇒ SplashGem
constructor
A new instance of SplashGem.
- #title_offset(elapsed) ⇒ Object
Constructor Details
#initialize(window) ⇒ SplashGem
Returns a new instance of SplashGem.
41 42 43 |
# File 'lib/bestguigui_lab/splash_scene.rb', line 41 def initialize(window) @window = window end |
Instance Method Details
#draw(elapsed, alpha) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/bestguigui_lab/splash_scene.rb', line 45 def draw(elapsed, alpha) center_x = @window.width / 2 center_y = center_y(elapsed) FACETS.each { |names, rgb| draw_facet(names, rgb, center_x, center_y, alpha) } draw_outline(center_x, center_y, alpha) end |
#title_offset(elapsed) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/bestguigui_lab/splash_scene.rb', line 53 def title_offset(elapsed) return 0 if elapsed < FALL if elapsed < FALL + BOUNCE_UP Helpers.lerp(IMPACT_DIP, 0, Helpers.ease_out((elapsed - FALL) / BOUNCE_UP)) else 0 end end |