ZIM Basics 12 - How to add a MotionController on the HTML 5 Canvas with JavaScript and ZIMjs
Channel: ZIM LEARN
Date: 09/07/2021

The ZIM MotionController lets you move ZIM DisplayObjects on the HTML 5 Canvas with JavaScript.  Generally, the ZIM Controls operate on existing Display Objects - with the MotionController, this could be a shape, a Sprite, a Pen, etc.  MotionController has a number of different types:

set to "mousemove" to have the target follow the mouse movement
set to "pressmove" to have target jump to mousedown position then follow while pressing
set to "pressdrag" to have target follow mouse if pressed on and then dragged 
set to "keydown" to use keys to control the target (see map parameter)
set to "gamebutton" to use gamepad buttons to control the target (see map parameter)
set to "gamestick" to use gamepad stick(s) to control the target (see map parameter)
set to "swipe" to use swipe to control the target
set to "follow" to mousedown and hold and use Frame.follow() to keep moving towards mouse or press position
set to "manual" to set your own with myController.convert() or myController.x and myController.y properties
set to a ZIM DPad object to use the DPad to control the motion 

Come discuss ZIM with us at https://zimjs.com/slack and https://zimjs.com/discord  We would love to see you there!