HTML 5 Canvas Library
 

mapRelative Library Method

Short Description: Map texture relative to current HTML element

Signature: t.mapRelative (s,t[,w,h])
Group: Texture
Class: transition Class
 

Maps a rectangular portion of the Texture Canvas as texture on to the animated object. (s,t) specify the coordinates of the top left point of the portion relative to the currently mapped texture. w is the with and h the height. If the w and h parameters are not give, they default to the original size of the element.

mapReleative is very similar to map with the difference that the coordinates (s,t) are relative to the currently mapped portion.

Examples

var a=taccgl.actor("testimg");a.mapRelative(a.w/2,0,a.w/2,a.h).start(); RUN
var a=taccgl.actor("testimg");a.mapRelative(a.w/2,0,a.w/2,a.h).resize(a.w/2,a.h).start(); RUN
var a=taccgl.actor("testimg");a.mapRelative(a.w/2,0,a.w/2,a.h).resize(a.w/2,a.h).position(a.x+a.w/2,a.y,0).start(); RUN

WebGL™ is a trademark of the Khronos Group Inc.

Next Page:transition.mapClip - Clip mapped texture
Previous Page: transition.mapMirrorX - Mirror texture in X direction
Please Add a Comment or Question, click here!