How to Write a hyphen play_javascript in JavaScript

Source: Internet
Author: User
This article mainly introduces the relevant information about JavaScript-based serialization games. For more information, see those who want to see them on a daily basis, don't I connect two identical images together? I can write one myself.

Write a file using Javascript and host it on github. view the Online DEMO address: Open

Final:

What should I consider before writing a link?

1: How can I determine whether two elements can be connected? I was wondering at the beginning. For details, refer to here: open;

2: How to choose the template engine? I used the template of the bottom-line library because the syntax is simple. I originally wanted to use Handlebars, but this is a bit big, and the bottom line Library also provides many common tool methods (• yunω • ́) y;

3, canvas has not been carefully studied;

4: How can we achieve the effect of line connection when two elements are connected? If dom is used for implementation, images need to be used. When the elements are connected, images are located in the connection path. You can also use canvas to directly draw the effect of the connection. I select the latter;

Because I did not consider low browsers, I used the zeptoJS library and referenced bootstrap based on my habits;

Three major constructor functions are used, including Data, View, and Score;

The View structure is as follows, which rarely includes event binding, interface generation, and drawing effect when two identical elements disappear:

View

/*** @ Desc generate map Based on Data **/renderHTML: function/*** @ desc Interface main event binding * @ return this; **/bindEvents: function/*** @ desc tool method, which is used for plotting on the canvas. * @ param [{x: 0, y: 0}, {x: 1, y: 1 }, {x: 2, y: 2}, {x: 3, y: 3}] An array, which is automatically repainted. **/showSparkLine: the template of the function tbody element is as follows:

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.