Skip to content
bapquad edited this page Feb 27, 2022 · 3 revisions

Learning more about CaremJS API Referernces.

Functions

Tick

Used to request animation frame.

Parameter

  • tickHandle:function - The tick handle for animation loop. Required

Return

Returns the animation ID.

Example

import {Tick} from '@bapquad/carem';

function Anim() 
{
  console.log(new Date());
  return Tick(Anim);
}

let tickID = Anim();

UnTick

Used to cancel animation frame request.

Parameter

  • animID:number - The animation ID. Required

Return

Returns the animation ID.

Example

import (Tick, UnTick) from '@bapquad/carem'

let i=0;
function Anim() 
{
  console.log("playing");
  if(i>=100) 
  {
    UnTick(tickID);
  }
  i++;
  return Tick(Anim);
}

let tickID = Anim();

Namespace

Carem

Namespace Carem has following classes allow you work with your games.

  • Layer - Contains data elements and methods of manipulating layer data.
  • Math - Contains the functions about mathematics.
  • Filter - Contains the graphics filters.
  • AssetManager - Manages the project's asset such as sounds, images.
  • Graphics - Manipulates the graphics data of the element.
  • SceneObject - Manages the scene data of the element.
  • SymbolArc - Manipulates the arc symbol.
  • SymbolCircle - Manipulates the circle symbol.
  • SymbolLine - Manipulates the line symbol.
  • SymbolOval - Manipulates the oval symbol.
  • SymbolPolygon - Manipulates the polygon symbol.
  • SymbolRect - Manipulates the rectangle symbol.
  • SymbolRoundRect - Manipulates the rounded rectangle symbol.
  • SymbolShape - Manipulates the shape symbol.
  • SymbolImage - Manipulates the image symbol.
  • SymbolText - Manipulates the text symbol.
  • Physics - Makes physical laws for the game.
  • WorldLimit - Manipulates the world limit of the scene.
  • Collision - Manages and checks the object collision.
  • Button - Manipulates the button of the game scene.
  • StaticSprite - Manipulates the static sprites.
  • AnimeSprite - Manipulates the animation for the sprites.
  • Scroller - Manipulates the background scroller in the scenes.
  • Particle - Manipulates the particle effects.
  • Tile - Manipulates the tiles for the scene layout.

Constants

For using the constants, maybe you need to import them from the package.

How to use

By example, we need to use the CAREM_PATH_RECT constant.

import {CAREM_PATH_RECT} from '@bapquad/carem'

console.log(CAREM_PATH_RECT);

So that, you can apply this usage for other constants.

CAREM_PATH_RECT

Hold the 1000 value.


CAREM_PATH_ROUND_RECT

Hold the 1001 value.


CAREM_PATH_CIRCLE

Hold the 1002 value.


CAREM_PATH_OVAL

Hold the 1003 value.


CAREM_PATH_ARC

Hold the 1004 value.


CAREM_PATH_POLYGON

Hold the 1005 value.


CAREM_PATH_LINE

Hold the 1006 value.


CAREM_PATH_SHAPE

Hold the 1007 value.


CAREM_PATH_TEXT

Hold the 1008 value.


CAREM_ALIGN_TOP

Hold the "TOP" value.


CAREM_ALIGN_MIDDLE

Hold the "MIDDLE" value.


CAREM_ALIGN_BOTTOM

Hold the "BOTTOM" value.


CAREM_ALIGN_LEFT

Hold the "LEFT" value.


CAREM_ALIGN_CENTER

Hold the "CENTER" value.


CAREM_ALIGN_RIGHT

Hold the "RIGHT" value.


CAREM_ORDER_LEFT

Hold the 0 value.


CAREM_ORDER_RIGHT

Hold the 1 value.


CAREM_QUEUE_IMAGE

Hold the 0 value.


CAREM_QUEUE_SOUND

Hold the 1 value.


CAREM_QUEUE_FONT

Hold the 2 value.


CAREM_LINE_CAP_DEFAULT

Hold the "butt" value.


CAREM_LINE_CAP_BUTT

Hold the "butt" value.


CAREM_LINE_CAP_ROUND

Hold the "round" value.


CAREM_LINE_CAP_SQUARE

Hold the "square" value.


CAREM_LINE_JOIN_DEFAULT

Hold the "miter" value.


CAREM_LINE_JOIN_MITER

Hold the "miter" value.


CAREM_LINE_JOIN_BEVEL

Hold the "bevel" value.


CAREM_LINE_JOIN_ROUND

Hold the "round" value.


CAREM_REPEAT

Hold the "repeat" value.


CAREM_REPEAT_X

Hold the "repeat-x" value.


CAREM_REPEAT_Y

Hold the "repeat-y" value.


CAREM_NO_REPEAT

Hold the "no-repeat" value.


CAREM_TEXT_BASELINE_TOP

Hold the "top" value.


CAREM_TEXT_BASELINE_BOTTOM

Hold the "bottom" value.


CAREM_TEXT_BASELINE_MIDDLE

Hold the "middle" value.


CAREM_TEXT_BASELINE_ALPHABETIC

Hold the "alphabetic" value.


CAREM_TEXT_BASELINE_HANGING

Hold the "hanging" value.


CAREM_TEXT_ALIGN_START

Hold the "start" value.


CAREM_TEXT_ALIGN_END

Hold the "end" value.


CAREM_TEXT_ALIGN_LEFT

Hold the "left" value.


CAREM_TEXT_ALIGN_CENTER

Hold the "center" value.


CAREM_TEXT_ALIGN_RIGHT

Hold the "right" value.


CAREM_GLOBAL_CO_SRCOVER

Hold the "source-over" value.


CAREM_GLOBAL_CO_SRCATOP

Hold the "source-atop" value.


CAREM_GLOBAL_CO_SRCIN

Hold the "source-in" value.


CAREM_GLOBAL_CO_SRCOUT

Hold the "source-out" value.


CAREM_GLOBAL_CO_DESTOVER

Hold the "destination-over" value.


CAREM_GLOBAL_CO_DESTATOP

Hold the "destination-atop" value.


CAREM_GLOBAL_CO_DESTIN

Hold the "destination-in" value.


CAREM_GLOBAL_CO_DESTOUT

Hold the "destination-out" value.


CAREM_GLOBAL_CO_LIGHTER

Hold the "lighter" value.


CAREM_GLOBAL_CO_COPY

Hold the "copy" value.


CAREM_GLOBAL_CO_XOR

Hold the "xor" value.


CAREM_FLIP_HORIZONTAL

Hold the 0 value.


CAREM_FLIP_VERTICLE

Hold the 1 value.


CAREM_LIMIT_OFF

Hold the 0 value.


CAREM_LIMIT_NULL

Hold the 1 value.


CAREM_LIMIT_CLAMP

Hold the 2 value.


CAREM_LIMIT_BOUNCE

Hold the 3 value.


CAREM_LIMIT_STICKY

Hold the 4 value.


CAREM_LIMIT_KILL

Hold the 5 value.


CAREM_LIMIT_LEFT

Hold the 0 value.


CAREM_LIMIT_TOP

Hold the 1 value.


CAREM_LIMIT_RIGHT

Hold the 2 value.


CAREM_LIMIT_BOTTOM

Hold the 3 value.


CAREM_HORIZONTAL

Hold the 0 value.


CAREM_VERTICLE

Hold the 1 value.


CAREM_LOOP_KILL

Hold the 0 value.


CAREM_LOOP_CYCLE

Hold the 1 value.


CAREM_COLLISION_RECT

Hold the 0 value.


CAREM_COLLISION_RAD

Hold the 1 value.


CAREM_ACTX

Hold the 0 value.

Clone this wiki locally