Creating Animated GUI?
Posted: Tue May 20, 2014 2:38 am
Is there a way to create animated GUI?
If yes,How?
If yes,How?
You could've simply deleted your post (I believe) instead of making a second one just to say that you did a mistake.bladestorm wrote:oh wait you said animated GUI my mistake
Code: Select all
If MilliSecs() > tmrSparks + 100 Then
tmrSparks=MilliSecs() ; 'reset' the timer
frmSparks=( frmSparks + 1 ) Mod 3 ; increment the frame, flip to 0 if we are out
End If
DrawImage gfxSparks,MouseX(),MouseY(),frmSparks ; draw the image
(taken from http://www.blitzbasic.com/b3ddocs/command.php?name=LoadAnimImage)
It's MaskImage.InnocentSam wrote:... In this case, you would also need to blend the image to remove the pink. I can't remember if the function is EntityBlend or BlendImage or ImageBlend or whatever. ...
you see i know almost othing about codingInnocentSam wrote:Find an image or make one that is like this, where each frame is in the same image and is the same distance apart each time:Let's say you want to use this to replace the blink icon. You'd go into the code and find where it loads the blink icon, and change the line of code from "LoadImage" to "LoadAnimImage", changing the variables to match the new image. In this case, you would also need to blend the image to remove the pink. I can't remember if the function is EntityBlend or BlendImage or ImageBlend or whatever. I'm sure a quick CTRL+F of Main.bb will yield something.
Then you'd have to make a loop to animate it in the function where the blink icon is drawn.Essentially you would adapt this; you declare tmr/frmSparks to be local to the DrawGUI function, then at the DrawImage for the blink icon, you'd add an extra variable to the end: "frmSparks" which would animate it.Code: Select all
If MilliSecs() > tmrSparks + 100 Then tmrSparks=MilliSecs() ; 'reset' the timer frmSparks=( frmSparks + 1 ) Mod 3 ; increment the frame, flip to 0 if we are out End If DrawImage gfxSparks,MouseX(),MouseY(),frmSparks ; draw the image (taken from http://www.blitzbasic.com/b3ddocs/command.php?name=LoadAnimImage)
You would still need to edit the source code for it to animate.bladestorm wrote:Can't you just create a gif image? Since they are the images that animate.
No, while gifs usually have multiple 'frames' within the file itself, they cannot animate themselves. The reason why lots of people believe what you believe is that they only view gifs in a browser or specialized image viewer that handles the animation. That being said, for the love of god, don't use gifs for something like this. It'd be much easier to make a sprite sheet and blit rectangles from it. Frankly, I can't remember how efficient B3D's sprites are, but provided you implement it properly you should be fine.bladestorm wrote:Can't you just create a gif image? Since they are the images that animate.