|
Revision 125, 0.6 kB
(checked in by why, 13 months ago)
|
|
* shoes/ruby.c: don't anti-alias the cursor.
* samples/follow.rb: background changes as the pointer moves.
|
| Line | |
|---|
| 1 | trails = [[0, 0]] * 60 |
|---|
| 2 | Shoes.app do |
|---|
| 3 | nostroke |
|---|
| 4 | fill rgb(0x30, 0xFF, 0xFF, 0.6) |
|---|
| 5 | |
|---|
| 6 | # animation at 24 frames per second |
|---|
| 7 | animate(24) do |
|---|
| 8 | trails.shift |
|---|
| 9 | trails << self.mouse[1, 2] |
|---|
| 10 | |
|---|
| 11 | clear do |
|---|
| 12 | # change the background based on where the pointer is |
|---|
| 13 | background rgb( |
|---|
| 14 | 20 + (70 * (trails.last[0].to_f / self.width)).to_i, |
|---|
| 15 | 20 + (70 * (trails.last[1].to_f / self.height)).to_i, |
|---|
| 16 | 51) |
|---|
| 17 | |
|---|
| 18 | # draw circles progressively bigger |
|---|
| 19 | trails.each_with_index do |(x, y), i| |
|---|
| 20 | i += 1 |
|---|
| 21 | oval :left => x, :top => y, :radius => i, :center => true |
|---|
| 22 | end |
|---|
| 23 | end |
|---|
| 24 | end |
|---|
| 25 | |
|---|
| 26 | end |
|---|