New Years Eve 2021 - Firework Particle Animation - Source Code

Started by kevin, January 03, 2021, 08:33:34 PM

Previous topic - Next topic

kevin

 New Years Eve 2021 -  Firework   Particle   Animation - Source Code







PlayBASIC Code: [Select]
     // Path to write the frames into..    uncomment the SaveBitmap statement bellow to actually save the anim.
destpath$="G:\Video-Editing\2020-12-31 - New Years Eve Animation\Anim\"

randomize 1510982349

#print timer()-(30*1000)




openscreen 1280,720,32,1

;Setfps 61.7
#include "savebitmap"
#include "blitimage"

//Variables
GLOBAL Speed#
GLOBAL parax#
GLOBAL paray#
GLOBAL paraz#
GLOBAL Angle1#
GLOBAL Angle2#

GLOBAL switch = 0
GLOBAL NbFeu = 600
GLOBAL Temps = 0


//Types

TYPE FeuArtifice
SpriteIndex
x#
y#
z#
vy#
xd#
yd#
zd#
size#
ENDTYPE

DIM Pouf AS FeuArtifice LIST

Dim ImageUsageCounters($ffff)


Dim ParticlesImages(1)

ParticleImage=MakeBall()


ParticlesImages(0) = ParticleImage
ParticlesImages(1) = LoadNewAFXimage("logos\2020-128by128.png")

Screen=NewFXIMage(GetScreenWidth(),GetScreenHeight())



Global Screen_Width = GetScreenWidth()
Global Screen_Height = GetScreenHeight()




// Boucle principale
REPEAT
RendertoIMage Screen


; for pass=1 to 2
IF Temps = 0
parax# = RNDrange(-150,150)
paray# = RNDRange(-120,60)
paraz# = RNDRange( 150,400)

IF swith = 0
Temps = rndrange(10,60)
ENDIF

; pick a colour for this batch
ThisRGB=RNDRGB()

inkmode 1+64
imageviewport getsurface(),0,0,getSurfacewidth(),GetSurfaceHeight()
boxc 0,0,getSurfacewidth(),GetSurfaceHeight(),true,$080808 ;rgbalphamult(ThisRGB,$2f2f2f)


inkmode 1

// PushParticles(parax#,paraz#)

THisImage=PreColourIMage(ParticleImage,ThisRGB)

FOR i = 1 TO NbFeu
NewFeu(parax#,paray#,paraz#,ThisImage,THisRGB)
NEXT

ENDIF

t=timer()
FOR EACH Pouf()
if AfficheFeu()=0
KillParticle()
endif
NEXT
tt1#+=(timer()-t)
Temps--


; next


t=timer()
;DRAWALLSPRITES
TEST_MultiPass(Screen,Sprites_DRaw_mode,6)
tt2#+=(timer()-t)


rendertoscreen



if 1=1

MaxFramesInDemo=60*50
if CurrentSaveFrame<MaxFramesInDemo
Render_Logos(Screen,CurrentSaveFrame,MaxFramesInDemo)

if folderexist(DestPath$)
file$=destpath$+"Frame"+Digits$(CurrentSaveFrame,6)+".bmp"
;SaveBitmap file$,Screen
CurrentSaveFrame++
endif
else
end
endif

endif


BlitImageAlphaPostMultColour(Screen,0,0,$F8f0e0)
; BlitImageAlpha50Colour(Screen,0,0,$010101)

setcursor 0,0
;
SYNC
Login required to view complete source code




Related Links

     - New Years Eve 2022 -  Firework   Particle   Animation - Source Code
    - New Years Eve 2020 -  Firework   Particle   Animation - Source Code
    - New Years Eve / Fireworks Particle Effect (Revision)