The following module I wrote is an adaptation of some of the methods in RGSS2's Graphics module for the RGSS Player version 1. I hope this is of use. It is released to the public domain.
Code:
module Graphics
@@fadeoutvp=Viewport.new(0,0,640,480)
@@fadeoutvp.z=0x3FFFFFFF
@@fadeoutvp.color=Color.new(0,0,0,0)
def self.brightness
return (255-@@fadeoutvp.color.alpha)
end
def self.brightness=(value)
value=0 if value<0
value=255 if value>255
@@fadeoutvp.color.alpha=255-value
end
def self.fadein(frames)
return if frames<=0
curvalue=self.brightness
count=(255-self.brightness)
frames.times do |i|
self.brightness=curvalue+(count*i/frames)
self.update
end
end
def self.wait(frames)
return if frames<=0
frames.times do |i|
self.update
end
end
def self.fadeout(frames)
return if frames<=0
curvalue=self.brightness
count=self.brightness
frames.times do |i|
self.brightness=curvalue-(count*i/frames)
self.update
end
end
end