Javascript lightweight library createjs uses Easel to implement drag-and-drop effects, createjseasel
I will share with you some of my experiences on learning Createjs:
1. What is CreateJS?
Createjs is a lightweight javascript library. It is an open-source toolkit for building HTML5 games with rich interactive experience. Using createjs, you can build many interesting animation games. For example, you can watch Html5 games such as multi-color games.
Ii. What tools does CreateJS have?
There are four engines in createjs:
- EaselJS: used to draw animations, vectors, and bitmaps. It provides a series of methods that support mobile device touch (click, mousedown, pressup, and pressmove are the mouse click, press, release, and move events, but createjs must be added before. touch. enable (<stage Object> )).
- TweenJS: it is an engine used to create compensation animation. It can produce a continuously changing effect. (Flash shoes should be used to know what an animation is)
- SoundJS: it is an audio playback engine. You can select the audio format for playback Based on the browser compatibility and performance. It can be loaded and detached at any time.
- PreloadJS: A Resource pre-loading engine. You can specify the loading sequence and group resources by priority.
3. How can I use Easel to create a simple drag?
If you need to use EaselJs to drag an image at will, and click the image to make the image in the selected or unselected status, the selected status is the drag status, if the status is not selected, it cannot be dragged. You can drag up to one image. So how can we use EaselJs to achieve this requirement and support mobile devices? Let's talk about the source code.
HTML code:
<Html>
Because of the same-origin policy of the browser, a local server needs to be opened; otherwise, the server cannot be loaded normally. Well, this is the image drag effect required above.
Articles you may be interested in:
- Div drag plug-in -- JQ. MoveBox. js (self-made JQ plug-in)
- Example of how Javascript achieves gravity bounce drag
- Extjs4: How to drag data between two gridpanels
- Javascript drag and drop upload class library DropzoneJS usage
- ExtJS drag result example
- Javascript Implementation of moving a child form by dragging the mouse
- Js drag and drop some common ideas and methods
- Nodejs + express + html5 implement drag-and-drop upload
- Js implementation drag effect
- JS pop-up complete div layer instance that can be dragged and closed