mapClipToElement Library Method
Short Description: Clips the currently mapped texture to the size of the animated object
Signature: t.mapClipToElement (pos,overflow)
Group: Texture
Class: transition Class
Clips the currently mapped texture to the size of the animated object.
If the size of the animated object is changed
e.g. using resize, hV, or wV
the texture image is normally resized as well. Also if the
image of one HTML is mapped on another element, the image is
normally resized to fit. Sometimes, however, resizing is not
desired. Then as an alternative it is possible to clip the
texture image in a way that no resizing is required. Clipping
avoids shrinking of the texture image at the expense of just showing part of
the image.
mapClipToElement can be called e.g. after a
shrinking resize and then will clip the texture
image in a way that no resizing is required. It can also be called e.g.
after mapActor to clip the mapped image in a way that no resizing is
required.
The parameters pos and overflow have the same meaning as with mapClip.
This is a test div with id="testdiv" for the samples below
Examples
var a=taccgl.actor("testimg"); a.resize(a.w/2,a.h).mapClipToElement("tl").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("testimg").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("testimg").mapClipToElement("bl").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("testimg").mapClipToElement("br").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("testimg").mapClipToElement("br","r").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("testimg").mapClipToElement("t").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("testimg").mapClipToElement("b").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("testimg").mapClipToElement("r").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("logoimg").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("logoimg").mapClipToElement("bl").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("logoimg").mapClipToElement("br","r").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("logoimg").mapClipToElement("br","b").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("logoimg").mapClipToElement("tl","br").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("logoimg").mapClipToElement("br","br").start(); | RUN |
var a=taccgl.actor("testdiv"); a.mapActor("logoimg").mapClipToElement("tr","br").start(); | RUN |
This method only works for rectangular textures, i.e. only together with map but not with mapT.
WebGL™ is a trademark of the Khronos Group Inc.
|