Previous Topic Tutorial Home Page Next Topic
The State and Structure of the Album


Kick-off the state machine. The "state" is a tuple with two number behaviors, one each for the left and right page indexes, a geometry behavior for the center page, and a sound behavior for the audio effects.
TupleBvr state = frontState();

extract the individual behaviors from the tuple
leftInd = (NumberBvr) state.nth(0);
rightInd = (NumberBvr) state.nth(1);
centerPage = (GeometryBvr) state.nth(2);
snd = (SoundBvr) state.nth(3);

extract the left and right pages and labels from their indices
GeometryBvr leftPage = ((GeometryBvr)picFrames.nth(leftInd)).transform(leftTrans);
GeometryBvr rightPage = ((GeometryBvr)picFrames.nth(rightInd)).transform(rightTrans);
StringBvr lPageLabel = (StringBvr)labels.nth(leftInd);
StringBvr rPageLabel = (StringBvr)labels.nth(rightInd);

now construct the album from the pages and the pivot line
ImageBvr album = overlay(renderPage(pivotLine),
overlay(renderPage(centerPage),
overlay(renderPage(rightPage),
renderPage(leftPage))));

Here, construct the two lables and position them under the album. Position them relative to the viewport to be at 12.5% from the bottom.
ImageBvr lLabel = renderStr(lPageLabel, labelColor,
neg(div(_halfWidth,toBvr(2))),
mul(toBvr(-0.75),_halfHeight));
ImageBvr rLabel = renderStr(rPageLabel, labelColor,
div(_halfWidth,toBvr(2)),
mul(toBvr(-0.75),_halfHeight));

The model is the album with the lables and a blue background.
ImageBvr model = overlay(album,
overlay(lLabel,
overlay(rLabel, solidColorImage(blue))));
setSound(snd);
setImage(model);


© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

Previous Topic Tutorial Home Page Next Topic