7 name:'my-first-dali-app'
10 'stereoscopic-mode':'mono', // stereo-horizontal, stereo-vertical, stereo-interlaced,
11 'stereo-base': 65 // Distance in millimeters between left/right cameras typically between (50-70mm)
15 'view-mode': viewMode,
18 var dali = require('./build/Release/dali')( options );
19 var netflixRoulette = require('netflix-roulette');
22 var NUMBER_OF_IMAGES = 40; // for now use 16 ( demo files go up to 30)
23 var DEMO_IMAGES = []; // array to store Dali Images
24 var VIDEO_WALL_ACTORS = []; // array to store Image actors
25 var VIDEO_WALL_ROWS = 5; // use 3 rows for the video wall
26 var VIDEO_WALL_COLUMNS = 6; // use 12 columns for the video wall
27 var VIDEO_WALL_TOTAL_ITEMS = VIDEO_WALL_COLUMNS * VIDEO_WALL_ROWS; // total items
28 var VIDEO_WALL_ITEM_SIZE = 128; // width / height of a item in the video wall
30 var VIDEO_WALL_ITEM_SIZE_NO_BORDER = VIDEO_WALL_ITEM_SIZE - BORDER_SIZE;
31 var VIDEO_WALL_WIDTH = VIDEO_WALL_COLUMNS * VIDEO_WALL_ITEM_SIZE;
32 var VIDEO_WALL_HEIGHT = VIDEO_WALL_ROWS * VIDEO_WALL_ITEM_SIZE;
36 var wallRootActor; // the root actor of the video wall
39 daliApp.loadNetflixImages = function() {
41 if( NUMBER_OF_IMAGES >= VIDEO_WALL_TOTAL_ITEMS)
43 NUMBER_OF_IMAGES = VIDEO_WALL_TOTAL_ITEMS-1;
46 for (index = 0; index < NUMBER_OF_IMAGES; ++index) {
48 fileName = posters[ index % (posters.length-1) ];
51 DEMO_IMAGES[index] = new dali.ResourceImage( { url:fileName } );
57 daliApp.createRootActor = function() {
58 wallRootActor = new dali.Actor();
59 wallRootActor.parentOrigin = dali.CENTER;
60 wallRootActor.anchorPoint = dali.CENTER;
61 dali.stage.add(wallRootActor);
63 var field = new dali.Control("TextField");
64 field.parentOrigin = dali.CENTER;
65 field.anchorPoint = dali.CENTER;
67 field.placeholderText = "DALi netflix netflix-roulette demo";
68 dali.stage.add( field );
73 daliApp.getWallActorIndex = function(x, y) {
74 return x + y * VIDEO_WALL_COLUMNS;
77 daliApp.createActors = function() {
78 daliApp.createRootActor();
80 var anim = new dali.Animation(1);
83 delay: 0.0, // used to delay the start of the animation
84 duration: 1, // duration of the animation
87 for (y = 0; y < VIDEO_WALL_ROWS; ++y) {
88 for (x = 0; x < VIDEO_WALL_COLUMNS; ++x) {
90 var actorIndex = daliApp.getWallActorIndex(x, y);
91 var imageActor = new dali.ImageActor();
93 // wrap image index between 0 and NUMBER_OF_IMAGES
94 var imageIndex = actorIndex % NUMBER_OF_IMAGES;
96 imageActor.setImage(DEMO_IMAGES[imageIndex]);
98 imageActor.parentOrigin = dali.CENTER;
99 imageActor.anchorPoint = dali.CENTER;
100 imageActor.size = [VIDEO_WALL_ITEM_SIZE_NO_BORDER, VIDEO_WALL_ITEM_SIZE_NO_BORDER, 1.0]; // start with zero size so it zooms up
102 var xPosition = x * VIDEO_WALL_ITEM_SIZE;
103 // as the middle the wall is at zero (relative to wallRootActor), we need to subtract half the wall width.
104 // + add half item size because the item anchor point is the center of the wallRootActor.
105 xPosition = xPosition - (VIDEO_WALL_WIDTH / 2) + (VIDEO_WALL_ITEM_SIZE / 2);
107 var yPosition = y * VIDEO_WALL_ITEM_SIZE;
108 yPosition = yPosition - (VIDEO_WALL_HEIGHT / 2) + (VIDEO_WALL_ITEM_SIZE / 2);
110 imageActor.position = [0,0,0];
112 animOptions.delay+=0.25;
113 anim.animateTo( imageActor,"position",[xPosition, yPosition, 0.0],animOptions);
115 VIDEO_WALL_ACTORS[actorIndex] = imageActor;
117 // Add to the video wall root actor.
118 wallRootActor.add(imageActor);
124 function Initialise() {
126 daliApp.loadNetflixImages();
128 daliApp.createActors();
131 function actorLoaded( error, data )
133 for( i = 0; i < data.length; ++i )
139 posters.push(entry.poster);
140 //console.log(" entry = " + entry.poster );
148 netflixRoulette.actor('nicolas', actorLoaded );