Rainbowaves

Advanced game related topics
User avatar
SPH
Enthusiast
Enthusiast
Posts: 268
Joined: Tue Jan 04, 2011 6:21 pm

Rainbowaves

Post by SPH »

I did this in 2006 but I haven't shown it much :
(Left Mouse Button to change)

Code: Select all

; SPH(2006)
; PB4 

InitSprite() 
InitMouse() 
InitKeyboard() 

;SetPriorityClass_ ( GetCurrentProcess_ (), #IDLE_PRIORITY_CLASS ) 

If ExamineDesktops() 
   dw.w=DesktopWidth(0) 
   dh.w=DesktopHeight(0) 
Else 
   dw.w=1024 
   dh.w=768 
EndIf 
dw2=dw/2
dh2=dh/2

dw1=dw/4
dw3=(dw/4)*3

OpenScreen(dw,dh,32,"") 

;;;;;;;;;;;
;;;;;;;;;;;
autre:
rr1.f=Random(5)+Random(1000)/1000
rr2.f=Random(5)+Random(1000)/1000
vv1.f=Random(5)+Random(1000)/1000
vv2.f=Random(5)+Random(1000)/1000
bb1.f=Random(5)+Random(1000)/1000
bb2.f=Random(5)+Random(1000)/1000
or1.f=rr1
or2.f=rr2
ov1.f=vv1
ov2.f=vv2
ob1.f=bb1
ob2.f=bb2
cr1.f=0.001+Random(1000)/10000
cr2.f=0.001+Random(1000)/10000
cv1.f=0.001+Random(1000)/10000
cv2.f=0.001+Random(1000)/10000
cb1.f=0.001+Random(1000)/10000
cb2.f=0.001+Random(1000)/10000

a1.f=0.001+Random(1000)/35000
a2.f=0.002+Random(1000)/35000
a3.f=0.003+Random(1000)/35000
a4.f=0.001+Random(1000)/35000
a5.f=0.002+Random(1000)/35000
a6.f=0.003+Random(1000)/35000

;;;;;;;;;;;
Repeat ; Until xmouse<>xmouse2 Or ymouse<>ymouse2 Or KeyboardPushed(#PB_Key_All) 

ExamineMouse() 
xmouse=MouseDeltaX()/55 ; /x : x= sensibilité
ymouse=MouseDeltaY()/55 ; /x : x= sensibilité
;*****
ClearScreen(0)
StartDrawing(ScreenOutput())


;;;;;;;;;;;

For i=0 To dh-1
r1=63+Cos(rr1)*63
r2=63+Sin(rr2)*63
v1=63+Cos(vv1)*63
v2=63+Cos(vv2)*63
b1=63+Sin(bb1)*63
b2=63+Sin(bb2)*63

rr=r1+v1+b1
vv=r2+v2+b2

;LineXY(0,i,dw,i,RGB(b1+b2,r1+r2,v1+v2))
;LineXY(dw2,i,dw,i,RGB(b1+b2,r1+r2,v1+v2))

LineXY(dw2-rr,i,dw2+vv,i,RGB(r1+r2,v1+v2,b1+b2))

rr1+a1
rr2+a2
vv1+a3
vv2+a4
bb1+a5
bb2+a6
Next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  2



or1+cr1
rr1=or1
or2+cr2
rr2=or2
ov1+cv1
vv1=ov1
ov2+cv2
vv2=ob2
ob1+cb1
bb1=ob1
ob2+cb2
bb2=ob2
;;;;;;;;;;;
StopDrawing() 
;*****
FlipBuffers() 

If MouseButton(#PB_MouseButton_Left)<>0
Goto autre
EndIf

ExamineKeyboard() 
Until KeyboardPushed(#PB_Key_All) 
End 
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Rainbowaves

Post by BarryG »

Nice! Reminds me a bit of the "Ray of Hope 2" demo on Amiga (watch from 1:20) -> https://youtu.be/EnPDc3bNPD4?t=80

How do you make it faster? I don't see any "Delay()" or such, so can it be made faster? Thanks.
User avatar
SPH
Enthusiast
Enthusiast
Posts: 268
Joined: Tue Jan 04, 2011 6:21 pm

Re: Rainbowaves

Post by SPH »

To speed up, some parts would have to be converted to ASM
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5342
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Rainbowaves

Post by Kwai chang caine »

Nice thing :D
Thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 281
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: Rainbowaves

Post by oreopa »

Im a total sucker for sinuses :)

Thx for sharing :)
Proud supporter of PB! * Musician * C64/6502 Freak
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 281
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: Rainbowaves

Post by oreopa »

BarryG wrote:How do you make it faster? I don't see any "Delay()" or such, so can it be made faster? Thanks.

Code: Select all

;SetPriorityClass_ ( GetCurrentProcess_ (), #IDLE_PRIORITY_CLASS )
I guess this optional line is here in case it uses whole cpu :)))) (or core/thread, whatever)

also..... "AMIGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH!"... :)

EDIT: Also could be faster with a sinus table(s), maybe... probably
Proud supporter of PB! * Musician * C64/6502 Freak
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Re: Rainbowaves

Post by Mijikai »

Nice effect :>
Denis
Enthusiast
Enthusiast
Posts: 704
Joined: Fri Apr 25, 2003 5:10 pm
Location: Doubs - France

Re: Rainbowaves

Post by Denis »

Nice one (pas mal...)
A+
Denis
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: Rainbowaves

Post by Olli »

oreopa wrote:Im a total sucker for sinuses
I suppose Google Translate has a bug...
User avatar
Tenaja
Addict
Addict
Posts: 1948
Joined: Tue Nov 09, 2010 10:15 pm

Re: Rainbowaves

Post by Tenaja »

I haven't viewed it, but I'm guessing he means sinusoidal shapes. That's how I read it, based on the title...
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 281
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: Rainbowaves

Post by oreopa »

Olli wrote:
oreopa wrote:Im a total sucker for sinuses
I suppose Google Translate has a bug...
Hehe. I guess it sounds pretty odd :) I'm no medical expert, but please, for heavens sake, DO NOT suck on other peoples sinuses... erm...

Indeed, I meant I like sinusoidal patterns. :D

PS: There should be a thread to collect the demo-like effects threads, there have been a few I recall... I might do it sometime
Proud supporter of PB! * Musician * C64/6502 Freak
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: Rainbowaves

Post by Olli »

SPH published a very beautiful effect since near 3 years (2018?).

@SPH if you remember your algo about a water mirroring effect, using horizontal sinus also, do not hesitate to add a subject here, about it.

Translate (real) : il y a 2/3 ans, tu as posté un effet miroir horizontal qui ressemblait à la surface de l'eau. Si tu t'en souviens, tu devrais l'ajouter dans un nouveau sujet aussi.
User avatar
SPH
Enthusiast
Enthusiast
Posts: 268
Joined: Tue Jan 04, 2011 6:21 pm

Re: Rainbowaves

Post by SPH »

Olli wrote:SPH published a very beautiful effect since near 3 years (2018?).

@SPH if you remember your algo about a water mirroring effect, using horizontal sinus also, do not hesitate to add a subject here, about it.

Translate (real) : il y a 2/3 ans, tu as posté un effet miroir horizontal qui ressemblait à la surface de l'eau. Si tu t'en souviens, tu devrais l'ajouter dans un nouveau sujet aussi.
=> http://xmas.free.fr/demo_dog.zip
http://HexaScrabble.com/
!i!i!i!i!i!i!i!i!i!
!i!i!i!i!i!i!
!i!i!i!
//// Informations ////
Portable LENOVO ideapad 110-17ACL 64 bits
Version de PB : 5.73LTS - 32 bits
Olli
Addict
Addict
Posts: 1071
Joined: Wed May 27, 2020 12:26 pm

Re: Rainbowaves

Post by Olli »

:shock:
I run away ! (ever with sinus for oreopa !)
User avatar
oreopa
Enthusiast
Enthusiast
Posts: 281
Joined: Sat Jun 24, 2006 3:29 am
Location: Edinburgh, Scotland.

Re: Rainbowaves

Post by oreopa »

Olli wrote::shock:
I run away ! (ever with sinus for oreopa !)
lol :D

EDIT: unfortunately Bool breaks that code in newer pb.... (olli's code)
Nice one. :D
Proud supporter of PB! * Musician * C64/6502 Freak
Post Reply