summaryrefslogtreecommitdiffhomepage
path: root/test/console.rb
blob: c7d29c45b5b1628fb3428f022681a828454e61c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
require 'ruby2d'

s1 = Square.new(x: 0, y: 0, size: 100, color: 'white')
s2 = Square.new(x: 100, y: 100, size: 50, color: 'green')
c = 0.0
switch = true

update do

  if switch
    c += 0.01
    if c > 1.0
      switch = false
    end
  else
    c -= 0.01
    if c < 0.0
      switch = true
    end
  end

  s1.color = [1, 1, 1, c]
end

show