Windows Picture frame animation Seamless link technology

Source: Internet
Author: User

Are you curious about how this is done?

In fact, it is very simple, which only uses a picture to achieve this effect.

In order to understand the above picture, I will use the picture to explain some concepts.

First of all, animation is made of frames, so in order to make animation, we have to make the frame, the production is finished and then string up on it.

So we can slice the image for the effect that only one picture will animate.

Start by dividing only one picture into 2 slices (where slices are just to better describe the understanding, but not slicing), like this

And we're going to implement the animation process equivalent to implementing such a frame

12 2112 2< Span style= "color: #99cc00;" >< Span style= "color: #ff0000;" >< Span style= "color: #ff0000;" > ... (The color or number represents the above slice, respectively)

Then we can set a variable g_noffset to represent the coordinates of the slice x.

Background picture length 400 width 300

Background image length is equal to Window_width window_height

int Game_paint (void *parms = NULL, int num_parms = 0)
{
SelectObject (G_BUFDC, G_hbackground); G_hbackground is a bitmap handle

The background picture coordinates (g_noffset, 0) are represented in coordinates (0, 0) length window_width-g_noffset width window_height
BitBlt (G_MDC, 0, 0, Window_width-g_noffset, window_height, G_BUFDC, G_noffset, 0, srccopy);

//The background image coordinates (0, 0) are represented in coordinates (Window_width-g_noffset, 0), length g_noffset width window_ HEIGHT
BitBlt (G_MDC, Window_width-g_noffset, 0, G_noffset, window_height, G_BUFDC, 0, 0, srccopy);

BitBlt (G_HDC, 0, 0, window_width, window_height, G_MDC, 0, 0, srccopy);

if (G_noffset >= 400)//if the coordinates are greater than or equal to the picture length set to 0
G_noffset = 0;
Else
G_noffset + = 2; Change the length of a slice

return 1;
}

The function of the above code is to control the position of the slice in the window display, so as to achieve the following effect.

If you don't understand my description, then look at the code:)

So to achieve the effect of animation, there is also a requirement is that the picture is connected to the end.

Windows Picture frame animation Seamless link technology

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.