BASIC

Author Topic: Blendscreen speed  (Read 2492 times)

Offline FutureCow

  • HelpEditor
  • Prof. Inline
  • ******
  • Posts: 680
    • View Profile
Blendscreen speed
« on: 2009-Oct-29 »
How about a parameter for BLENDSCREEN for setting the speed in which it blends from one image to the other?

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10715
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Blendscreen speed
« Reply #1 on: 2009-Oct-29 »
ok, I'll add that.

Offline bigsofty

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 2631
    • View Profile
Re: Blendscreen speed
« Reply #2 on: 2009-Oct-29 »
Quick fix, should work on iPhone in landscape too...?

Code: GLBasic [Select]
// --------------------------------- //
// Project: ImageSwap
// Start: Thursday, October 29, 2009
// IDE Version: 7.149


LOADSPRITE "me.jpg", 0
LOADSPRITE "avatar_2.jpg", 1
ts = GETTIMERALL()
tt = 10 // 10 sec swap
WHILE 1
        imageMerge((((ts+(tt*1000))-GETTIMERALL())/1000)/tt , 0, 1, 100, 100)
SHOWSCREEN
WEND
END



// ------------------------------------------------------------- //
// ---  IMAGEMERGE  // % of swap (0..1) ---
// ------------------------------------------------------------- //
FUNCTION imageMerge: amount, image0, image1, x, y
IF amount < 0 OR amount > 1 THEN amount = 0.000000001 // GLB not like 0 alpha?
ALPHAMODE 1-amount
DRAWSPRITE image0, x, y
ALPHAMODE amount
DRAWSPRITE image1, x, y
ENDFUNCTION // IMAGEMERGE

P.S. I use something like CREATESCREEN to merge complete screens with the above ;)
« Last Edit: 2009-Oct-29 by bigsofty »
Cheers,

Ian.

“It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration.”
(E. W. Dijkstra)