The sprite.quad property is a list of four points that specify the screen coordinates of the corners of a sprite. If the quad property is set in Lingo, Director will distort the sprite accordingly. This allows the rendering of 3D rotation of a sprite.
Drag on the screen to spin the object
Quad property – source movie
sp = sprite(me.spritenum)
verts = 
verts = vector(-1,1,0)
verts = vector(1,1,0)
verts = vector(1,-1,0)
verts = vector(-1,-1,0)
trans = transform()
trans.scale = vector(150,150,1)
rotVelo = vector(.3,.2,0)
eyez = 500
ptList = 
repeat with v = 1 to 4
vec = trans * verts[v]
persp = eyez / (vec.z + eyez)
pt = point(vec.x * persp, vec.y * persp) + stageCenter
sp.quad = ptList
The animation model in this demo consists of four vectors, a transform, and a rotational velocity. The four vectors specify the corners of the object, and are analogous to a “model resource”. The transform is used to specify the scale, translation, and rotation of the object. Each model frame, the transform is rotated by a vector that specifies rotational velocity.
The model could have been stored in four vectors that specify 3D world coordinates, without using a transform. But keeping the resource information and transform separate makes transforming easier, and makes it easier to animate the corners with respect to each other.
•How would you change the “registration point” of the plane?
Multiplying each resource vector by the transform gives the 3D world coordinates of the corners. The perspective equation is then used to map the 3D points to 2D. The 2D points are put in a list which is used to set the sprite’s quad property. The order of the points is clockwise from upper-left for right side up facing the viewer, which is the reason for the order of the resource vectors.
The next section shows how to combine quads to make 3D objects.
- Nevertheless these battles of men against women
- Five Reasons to Hire a Professional Web Design Team