// Project: Interopolation-colourRGB
// Created: 2017-02-26
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Interopolation-colourRGB" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
global color1red, color1green, color1blue, color2red, color2green, color2blue
// Change these RGB values
color1red=200
color1green=255
color1blue=20
color1 = MakeColor(color1red, color1green, color1blue)
// Change these RGB values
color2red=2
color2green=22
color2blue=255
color2 = MakeColor(color2red, color2green, color2blue)
freq#=0
do
DrawBox(10,10,80,80,color1, color1,color1,color1,1)
DrawBox(700,10,780,80,color2, color2,color2,color2,1)
lerpcolor(freq#)
inc freq#, 0.01
if freq#=>1 then freq#=0
Print( ScreenFPS() )
Sync()
sleep(20)
loop
function lerpcolor (step#)
color3red = color1red + ( color2red - color1red ) * step#
color3green = color1green + ( color2green - color1green ) * step#
color3blue = color1blue + ( color2blue - color1blue ) * step#
color3 = MakeColor(color3red, color3green, color3blue)
DrawBox(400,10,480,80,color3, color3,color3,color3,1)
endfunction
Could be used for dissolving / fading / blending techniques with images
Enjoy!
Damo