How to create animated images
Using ShotGraph you can create animated GIFs on-line as well as static ones.
To create an animation you should use the special object called animation track.
This abject is created every time you create the "shotgraph.image"
object. Just after creation the animation track is empty.
To create an animation, you should do the following:
The animation track use your working image size and palette are defined
in the time of first calling TrackAdd.
- Create a "shotgraph.image" object.
- Make the necessary drawings.
- Call TrackAdd function.
- Repeat steps 2 and 3 as many times as necessary
- If you want your animation to be circled, call TrackLoop
- Call TrackPlay function to get
animated file or binary stream data.
You can not create an animated image from empty track.
Note. ShotGraph is not a specialized GIF animator. The animation
features are only additional cababilities of this software. The main goal
of this program is the making of static images on the fly for your
To get fully colorized animations with your custom graphics included
with necessary colors, you can use local clipboard, instead of direct
drawing the image in the main working space and sending the ready frame directly
to the animation track. You can use this method if the summary color palette
is too big or indefined.
The necessary steps are shown below:
- Create the clipboard of necessary size by calling InitClipboard function.
The clipboard area size should be enough to include all animation frames
- Make the clipboard working area active, by calling SelectClipboard function.
- Place all frames on the clipboard area.
- Call either WebPalette or BuildPalette method
to calculate and rebuild the new image palette.
- Copy frame by frame from clipboard using Copy method to main working image space and
sequentally add them to the animation track.
- Call TrackPlay method to create the animation.
As example, let's join two GIF images together to create the animation.
There are our two files, frame1.gif and frame2.gif. The picture size
of every file is 400x50 pixels.
As you see, the summary palette size of both files is bigger then
maximal available (256), so we will need recalculate the resulting
palette on the clipboard. The script producing the animation is quite
short, here it is:
The result of script working is the file frames12.gif: