JavaScript Lightweight library Createjs use easel to implement drag-and-drop effects _javascript techniques

Source: Internet
Author: User
Tags abs addchild

I will take my learning createjs some experience to share with you:

A. What is Createjs?

Createjs is a lightweight JavaScript library, an open source toolkit for HTML5 games that can build a rich interactive experience, using Createjs to build many interesting animation games. For example, surround the nerve cat, see you have many color such as HTML5 game.

Two. What are the Createjs tools?

There are four engines in Createjs:

    • Easeljs: Mainly used in animation, vector and bitmap rendering. Provides a range of methods to support mobile device touch (click, MouseDown, Pressup, pressmove for mouse clicks, press, release, and move events, but before adding Createjs. Touch.enable (< Stage object >)).
    • Tweenjs: is a motion tween animation engine, can produce a continuous change effect. (Children's shoes with flash should know what a motion tween is)
    • Soundjs: is an audio playback engine, according to browser compatibility and performance selection audio format playback, can be loaded and unloaded at any time.
    • Preloadjs: is a resource preload engine that can also specify the loading order and load resources by priority grouping.

Three. How to use easel to make a simple drag-and-drop?

Then if you need to use the EASELJS implementation can drag and drop a picture, and by clicking the picture to make the picture checked or unchecked, the selected state is a drag state, unchecked state is not dragging state. And at most one picture can be dragged and pulled. So how do you use EASELJS to implement this requirement and support the mobile-end device? Nonsense not much to say, on the source.

HTML code:

 


Because of the browser's homology policy, a local server needs to be opened, otherwise it will not load properly. OK, so that's the picture drag-and-drop effect you've asked for.

Related Article

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.