BHT MIDIBHT Mosaic
This is a plugin for Construct 2 by Scirra. Last updated: Aug 12 2014

This plugin provides the ability to simulate a mosaic tile mechanism of transitioning a texture from one image to another via rotating each tile, independently, as an animation.

Introduction

The plugin lets the user apply two textured objects to the Mosaic object, break the image into a grid of tiles, and then perform a 2D projected rotation on each tile to transition from the front of the tile to the back of the tile.

There are two areas to consider when implementing this mechanism; the overall object size, and the 'camera' view of the textures. If you look at the image above you see that as the tiles rotate they extend beyond the edges of the default texture area. By having these two areas, you can control how much of the projection is allowed to seep out of the default texture size. Having the object size and camera size the same, will clip all rotations on the edges to the base texture size. It's up to you how much of the projection you want to encroch on the underlying scene.

Keeping the camera concept, there is also the concept of how much of a projection to display. Z-cam is used to specify how much the tile rotates 'out' of the 2D-plane. A small value will be quite extreme and quickly extend beyond any clipping area. A large value will keep the tile very flat and appear to just get thinner, then wider, as it rotates, with no visible projection. Again, it's up to you to find a value that you find appealing.

Installing
Drag the C2ADDON file onto the Construct GUI to install the plugin.
Properties
Columns
The number of columns in the mosaic.
Rows
The number of rows in the mosaic.
Initial visibility
Choose whether the object is visible when the layout starts.
Show grid
Choose whether to show the grid when the layout starts.
Z-cam
Zcam is the 'camera' offset in the Z-axis for the perpective calculation. The smaller the value, the closer the camera is to the object, and the greater the perspective. Min: 0.1
Camera width
The width of the window for the default texture display.
Camera height
The height of the window for the default texture display.
Hotspot
The hotspot of the object. Top-left or Center.
Conditions
Is animation running
Check if the animation is running.
On all finished
Triggered when all animations/rotations have finished.
Actions
Mosaic
Grid visibility
Set the visibility of the grid.
Refresh
Refresh the currently displayed cells to their current textures.
Run
Run the animation/rotations based on each cells settings.
Set back texture
Set the 'back' texture of the mosaic.
Set camera size
Set the size of the un-rotated mosaic window. Textures will be scaled to this size, but if you want maximum quality, it should match all texture sizes. (That is, all textures should be the same size.)
Set front texture
Set the 'front' texture of the mosaic.
Set grid dimensions
Set the grid dimensions of the mosaic. 1x1 will be a single tile that rotates the whole texture.
Stop
Stop the animation/rotations.
Synchronize sizes
This recalculates all of the clipping areas for each tile based on all of the mosaic parameters, and the cell parameters. To avoid constantly recalculating and copying textures on every change, all parameter changes are just cached until this call is made.
Zcam
Set the Zcam offset value used to alter the depth of the rotation in the z-axis. Min: 0.1. See the Introduction for an explaination of what this means.
Mosaic Cell
Reset
Reset the cell rotations back to their initial valies. Use (-1,-1) to reset all at once. This is only needed if you do not change any of the cell parameters, and just want to rerun the current paramaters.
Set cell parameters
Set up the cell parameters for the animation.
Column - the column number
Row - the row number
Front index - the index of the cell's 'front' texture
Back index - the index of the cell's 'back' texture
Rate - the rotation rate, in degrees-per-second
Rotation axis - the axis to rotate around: X-axis or Y-axis. Both axis may be supported in the future, but not currently.
Target - the target angle to rotate to (from zero)
Delay - the delay until the rotation starts, in milliseconds
Set cell parameters (explicit)
Set up the cell parameters for the animation. This variation takes explicit values (the rotation axis is not a GUI object) so that you can maintain the same value if desired by using the corresponding expression (BHTMosaic.CellRotationAxis(Column, Row) in this case).
Column - the column number
Row - the row number
Front index - the index of the cell's 'front' texture
Back index - the index of the cell's 'back' texture
Rate - the rotation rate, in degrees-per-second
Rotation axis - the axis to rotate around: 1 for X-axis or 2 for Y-axis. Both axis may be supported in the future, but not currently.
Target - the target angle to rotate to (from zero)
Delay - the delay until the rotation starts, in milliseconds
Set cell back texture
Set the 'back' texture for the cell.
Column - the column number
Row - the row number
Texture - texture to use
Set cell front texture
Set the 'front' texture for the cell.
Column - the column number
Row - the row number
Texture - texture to use
Downloads
BHT Mosaic - v1.3 - added hotspot
BHT Mosaic - v1.2 - fixed opacity bug
BHT Mosaic - v1.1 - added ability to set individual cell textures
BHT Mosaic - v1.0

Card example CAPX
Individual textures example CAPX
Rotation example CAPX

Card example
Rotation example