HTML5 Canvas 2D Library
 

restrict Library Method

Short Description: Take part of Object

Signature: t.restrict (x,y,w,h)
Group: Shape
Class: transition Class
 

In most cases, restrict is used to animate a rectangular part of the (image of the) element associated with the transition. (x,y) denote the coordinates of the top left corner of the part, w gives the width and h the height.

There is, however, no restriction that reqires the rectangular part to be really completely contained inside the element. In fact (x,y,w,h) can denote any part of the page and then the transition animates whatever is drawn on the texture canvas.

restrict must be used before most of the other methods, before any of hvec, wvec, dvec, before any of the motion methods and before any of the texture methods.

Examples

var a=taccgl.actor("testimg"); a.restrict (a.x0,a.y0,a.wx0/2,a.hy0).start(); RUN
var a=taccgl.actor("testimg"); a.restrict (a.x0+a.wx0/4,a.y0,a.wx0/2,a.hy0).rotateMiddle(1,0,0).start(); RUN
var a=taccgl.actor("testimg"); a.restrict (a.x0,a.y0,a.wx0/2,a.hy0).rotateMiddle(1,0,0).start();
var b=taccgl.a("testimg"); b.restrict (b.x0+b.wx0/2,b.y0,b.wx0/2,b.hy0).rotateMiddle(1,0,0)
.rotatePart(Math.PI*6,Math.PI*2).start();
RUN

WebGL™ is a trademark of the Khronos Group Inc.

Next Page:transition.clipA - Clipping Animation
Previous Page: transition.dvec1 - Animate Depth Vector of Object