ImageBvr blockImg = solidColorImage(clr).
crop(point2(toBvr(0), toBvr(0)),
point2(toBvr(0.005), toBvr(0.005)));
DraggableImage grabImg = new DraggableImage(blockImg, origin2);
Initialize clr. Let it start out as red, change it to blue,
when the square is grabbed, and return to red when the square
is released. The grab and release events are obtained from the
getGrabEvent() and getReleaseEvent() methods of the DraggableImage
class respectively. |
clr.init(until(red, grabImg.getGrabEvent(),
until(blue, grabImg.getReleaseEvent(), clr)));
Get the ImageBvr part of grabImg, by calling the getImageBvr() method
of DraggableImage. |
ImageBvr pickableBlockImg = grabImg.getImageBvr();
overlay pickableBlockImg on a black background. |
setImage(overlay(pickableBlockImg, solidColorImage(black)));
}
}
That's all there is to it. Happy animating... |