How to handle animations?

Find quick help here to get you started with Hollywood
Post Reply
amyren
Posts: 429
Joined: Thu May 02, 2019 11:53 am

How to handle animations?

Post by amyren »

I've been browsing the anim library commands in the help documentation.
There is the BeginAnimStream command that lets you make a new anim file and add frames to it.
And the CreateAnim command which also makes a new anim file from a single brush
But how to add more frames to that anim file later?
Same if I load an animation file with LoadAnim, is there a way to edit (overwrite a frame) or to add new frames from a brush into it?
plouf
Posts: 690
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: How to handle animations?

Post by plouf »

ModifyAnimFrames() can add or remove frames

If you load anim tou need to create a new anim and apppend frame by frame there..
Christos
amyren
Posts: 429
Joined: Thu May 02, 2019 11:53 am

Re: How to handle animations?

Post by amyren »

I did read about ModifyAnimFrames() in the docs.
Although it can expand or shrink the number of frames it does not mention how to put content (eg. a brush) into the new frame you added.
To be honest I have a hard time seeing the point of adding frames to an anim if its just empty frames.
plouf
Posts: 690
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: How to handle animations?

Post by plouf »

i see your point, a function like AnimFrameFromBrush() would make sense to modify existing frames

btw jsut to point that CreateAnim() creates whole anims (all frames) from brush not just a single frame
here an example

Code: Select all

CreateBrush(1,200,20,#GREEN) ; Create a sprite sequence "old style"
SelectBrush(1)
For i=0 To 9
TextOut(i*20+5,5,i)
Next 
EndSelect()

DisplayBrush(1,1,1)          ; see it live how it looks
Wait(100)
Cls(#BLACK)
	
CreateAnim(1,1,20,20,10,10)  ; create an anim from that "tape"
For i=1 To 10
	DisplayAnimFrame(1,1,1,i)   ; lets see it 
	Wait(50)
Next
so you can load frame by frame to a big brush, then create a BeginAnimStream() to save your "brushes" to disk in your order
definitely not convient !
Christos
amyren
Posts: 429
Joined: Thu May 02, 2019 11:53 am

Re: How to handle animations?

Post by amyren »

Similar to my thoughts, I was thinking since you have LoadAnimFrame() it would be nice to have SaveAnimFrame() as well.
Perhaps AnimFrameFromBrush() describes its purpose better.
plouf
Posts: 690
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: How to handle animations?

Post by plouf »

ok... my mistake too even not in anim library there is SelectAnim() which you can select ANY frame (the new blank or existing) and start drawing there
like DisplayBrush()...

so it is possible :)

i modify above example, creating anim, then add a new frame, and draw in new frame

Code: Select all

CreateBrush(1,200,20,#GREEN) ; Create a sprite sequence "old style"
SelectBrush(1)
For i=0 To 9
TextOut(i*20+5,5,i)
Next 
EndSelect()

DisplayBrush(1,1,1)          ; see it live how it looks
Wait(100)
Cls(#BLACK)
	
CreateAnim(1,1,20,20,4,4)  ; create an 4 frame anim from that "tape"
For i=1 To 4
	DisplayAnimFrame(1,1,1,i)   ; lets see it 
	Wait(50)
Next


CreateBrush(2,20,20,#RED)	; lets create a new brush
ModifyAnimFrames(1,1,3)		;add a frame in middle (frame 3 making it a 5 frame anim)
; draw the new brush
SelectAnim(1,3)
DisplayBrush(2,1,1)			; draw than new frame with the RED new brush
EndSelect()

For i=1 To 5
	DisplayAnimFrame(1,1,1,i)   ; lets see our new 5 frame anim
	Wait(50)
Next
Christos
Post Reply