November 22, 2024

Carousel Script

Scripts i Used forĀ Carousel

/*
pn_position

Script No.1 for 5 Panels acting like Carousel up/down.
ScreenResolution is 1080×1920 FULLHD
without Statusbar and without Softkeys.
Working only for Portraitmode.
If Screenres. is different you have to change
some Variables.

Panels A,B,C,D and E are detached from Grid.
Other Stuff on Grid or detached doesn’t matter

Panel Scroll-Setting > Horizontal only or None
Desktop Scroll-Setting > Horizontal only or None
Desktop Events > Swipe up > run Script >pn_swp_up
Desktop Events > Swipe down > run Script >pn_swp_dwn
Position of Panels will be changed by this Script
Width is ScreenWidth
Height is here 1120 not changed by this Script

Scrolling is done by Scripts
No.2 pn_swp_up
and
No.3 pn_swp_dwn

No.4 pn_a when tap Shortcut in Panel A
No.5 pn_b when tap Shortcut in Panel B
No.6 pn_c when tap Shortcut in Panel C
No.7 pn_d when tap Shortcut in Panel D
No.8 pn_e when tap Shortcut in Panel E

*/

/* get the Parameter */
var PnOrder=LL.getEvent().getData();
PnOrder=PnOrder.substr(1,5);

/*
only allowed
ABCDE
BCDEA
CDEAB
DEABC
EABCD

 

*/

/* total available screen dimension */
/* not used yet */
var ll_Width=1080;
var ll_Heigth=1920;

/* Shortcut Labels */
var pn_LabelA=’Home’;
var pn_LabelB=’Media’;
var pn_LabelC=’Tools’;
var pn_LabelD=’Favorites’;
var pn_LabelE=’Social’;

/* Panel Names */
var pn_pnA=’pn_pna’;
var pn_pnB=’pn_pnb’;
var pn_pnC=’pn_pnc’;
var pn_pnD=’pn_pnd’;
var pn_pnE=’pn_pne’;

/* dimensions of the panels */
/* not used yet */
var pn_PWidth=ll_Width;
var pn_PHeight=1120;

/* Vertical Position up>down */
/* if available screensize is not FULLHD this has to be changed */
var pn_VPos1=160;
var pn_VPos2=240;
var pn_VPos3=320;
var pn_VPos4=1440;
var pn_VPos5=1520;

/* Horizontal Position up>down*/
var pn_HPos1=0;
var pn_HPos2=0;
var pn_HPos3=0;
var pn_HPos4=0;
var pn_HPos5=0;

/* Integer Color of the Shortcut Labels when “active” */
var pn_ClrA=-13388315; // ff33b5e5 blue
var pn_ClrB=-5609780; // ffaa66cc violet
var pn_ClrC=-48060; // ffff4444 red
var pn_ClrD=-17613; // ffffbb33 orange
var pn_ClrE=-6697984; // ff99cc00 green
var ClrIAct=-5460820 // ffacacac lightgrey

/* Panels which has to be moved into foreground */
var pn_Upnl1=’pn_pnbot’;
var pn_Upnl2=’pn_pnleft’;
var pn_Upnl3=’pn_pnright’;

/* fontsizes Small, Medium, Large for shortcuts */
pn_FontSizeS=24;
pn_FontSizeM=32;
pn_FontSizeL=48;

/* get desktop */
/* if name is different change it */
var desk=LL.getDesktopByName(‘paternoster’) ;

/* */
switch(PnOrder){
case ‘ABCDE’:

/* get the panels */
var p1=desk. getItemByLabel(pn_pnA);
var p2=desk. getItemByLabel(pn_pnB);
var p3=desk. getItemByLabel(pn_pnC);
var p4=desk. getItemByLabel(pn_pnD);
var p5=desk. getItemByLabel(pn_pnE);

/* set Labels */
var s1l=pn_LabelA;
var s2l=pn_LabelB;
var s3l=pn_LabelC;
var s4l=pn_LabelD;
var s5l=pn_LabelE;

/* set active color */
var ClrAct=pn_ClrC;
break;
case ‘BCDEA’:

var p1=desk. getItemByLabel(pn_pnB);
var p2=desk. getItemByLabel(pn_pnC);
var p3=desk. getItemByLabel(pn_pnD);
var p4=desk. getItemByLabel(pn_pnE);
var p5=desk. getItemByLabel(pn_pnA);

var s1l=pn_LabelB;
var s2l=pn_LabelC;
var s3l=pn_LabelD;
var s4l=pn_LabelE;
var s5l=pn_LabelA;

var ClrAct=pn_ClrD;

break;
case ‘CDEAB’:

var p1=desk. getItemByLabel(pn_pnC);
var p2=desk. getItemByLabel(pn_pnD);
var p3=desk. getItemByLabel(pn_pnE);
var p4=desk. getItemByLabel(pn_pnA);
var p5=desk. getItemByLabel(pn_pnB);

var s1l=pn_LabelC;
var s2l=pn_LabelD;
var s3l=pn_LabelE;
var s4l=pn_LabelA;
var s5l=pn_LabelB;

var ClrAct=pn_ClrE;

break;
case ‘DEABC’:

var p1=desk. getItemByLabel(pn_pnD);
var p2=desk. getItemByLabel(pn_pnE);
var p3=desk. getItemByLabel(pn_pnA);
var p4=desk. getItemByLabel(pn_pnB);
var p5=desk. getItemByLabel(pn_pnC);

var s1l=pn_LabelD;
var s2l=pn_LabelE;
var s3l=pn_LabelA;
var s4l=pn_LabelB;
var s5l=pn_LabelC;

var ClrAct=pn_ClrA;

break;
case ‘EABCD’:

var p1=desk. getItemByLabel(pn_pnE);
var p2=desk. getItemByLabel(pn_pnA);
var p3=desk. getItemByLabel(pn_pnB);
var p4=desk. getItemByLabel(pn_pnC);
var p5=desk. getItemByLabel(pn_pnD);

var s1l=pn_LabelE;
var s2l=pn_LabelA;
var s3l=pn_LabelB;
var s4l=pn_LabelC;
var s5l=pn_LabelD;

var ClrAct=pn_ClrB;

break;
default: return;
}
/* get the Id from the panels */
var p1i=p1.getId() ;
var p2i=p2.getId();
var p3i=p3.getId();
var p4i=p4.getId();
var p5i=p5.getId();
/* get the panels from the panels
which has to be set into foreground */

var Upnl1=desk. getItemByLabel(pn_Upnl1);
var Upnl2=desk. getItemByLabel(pn_Upnl2);
var Upnl3=desk. getItemByLabel(pn_Upnl3);
/* get the Ids from the panels
which has to be set into foreground */
var Upnl1i=Upnl1.getId();
var Upnl2i=Upnl2.getId();
var Upnl3i=Upnl3.getId();

/* set new posistion of the panels */
p1. setPosition(pn_HPos1,pn_VPos1);
p2. setPosition(pn_HPos2,pn_VPos2);
p3. setPosition(pn_HPos3,pn_VPos3);
p4. setPosition(pn_HPos4,pn_VPos4);
p5. setPosition(pn_HPos5,pn_VPos5);

/* set layer position of the panels */
desk. setItemZIndex(p1i, 10);
desk. setItemZIndex(p2i, 20);
desk. setItemZIndex(p3i, 30);
desk. setItemZIndex(p4i, 40);
desk. setItemZIndex(p5i, 50);

desk. setItemZIndex(Upnl1i,100);
desk. setItemZIndex(Upnl2i,110);
desk. setItemZIndex(Upnl3i,120);

/* get containerId of the moved panels */
var p1c=p1.getContainer() ;
var p2c=p2.getContainer();
var p3c=p3.getContainer();
var p4c=p4.getContainer();
var p5c=p5.getContainer();

/* get the Shortcuts inside the moved panels */
var sc1=p1c. getItemByLabel(s1l) ;
var sc2=p2c. getItemByLabel(s2l) ;
var sc3=p3c. getItemByLabel(s3l) ;
var sc4=p4c. getItemByLabel(s4l) ;
var sc5=p5c. getItemByLabel(s5l) ;

/* set color and fontsize of the Shurtcuts*/
sc1. getProperties(). edit(). setInteger(‘s.labelFontColor’,ClrIAct). setFloat(‘s.labelFontSize’, pn_FontSizeS). commit() ;
sc2. getProperties(). edit(). setInteger(‘s.labelFontColor’,ClrIAct). setFloat(‘s.labelFontSize’, pn_FontSizeM).commit() ;
sc4. getProperties(). edit(). setInteger(‘s.labelFontColor’,ClrIAct).setFloat(‘s.labelFontSize’, pn_FontSizeM).commit() ;
sc5. getProperties(). edit(). setInteger(‘s.labelFontColor’,ClrIAct).setFloat(‘s.labelFontSize’, pn_FontSizeS).commit() ;

/* set color and fontsize of the “active” Shurtcuts*/
sc3. getProperties(). edit(). setInteger(‘s.labelFontColor’,ClrAct).setFloat(‘s.labelFontSize’, pn_FontSizeL).commit() ;

_______________________________________________________________________

/*
pn_swp_dwn
swipe down
*/

var desk=LL.getDesktopByName(‘paternoster’) ;

var pna=desk. getItemByLabel(‘pn_pna’);
var pnb=desk. getItemByLabel(‘pn_pnb’);
var pnc=desk. getItemByLabel(‘pn_pnc’);
var pnd=desk. getItemByLabel(‘pn_pnd’);
var pne=desk. getItemByLabel(‘pn_pne’);

var pnai=pna.getId();
var pnbi=pnb.getId();
var pnci=pnc.getId();
var pndi=pnd.getId();
var pnei=pne.getId();
var ap=desk. getItemZIndex(pnai) ;
var bp=desk. getItemZIndex(pnbi) ;
var cp=desk. getItemZIndex(pnci) ;
var dp=desk. getItemZIndex(pndi) ;
var ep=desk. getItemZIndex(pnei) ;

var maxi=ap;
if (bp>maxi) maxi=bp;
if (cp>maxi) maxi=cp;
if (dp>maxi) maxi=dp;
if (ep>maxi) maxi=ep;
maxi=maxi-2; /* the actice */
if (ap==maxi) {
void LL. runScript(‘pn_position’, ‘CDEAB’ ) ;
return;
}

if (bp==maxi) {
void LL. runScript(‘pn_position’, ‘DEABC’ ) ;
return;
}

if (cp==maxi) {
void LL. runScript(‘pn_position’, ‘EABCD’ ) ;
return;
}

if (dp==maxi) {
void LL. runScript(‘pn_position’, ‘ABCDE’ ) ;
return;
}

if (ep==maxi) {
void LL. runScript(‘pn_position’, ‘BCDEA’ ) ;
return;
}

_______________________________________________________________________

 

/*
pn_swp_up
swipe up
*/

var desk=LL.getDesktopByName(‘paternoster’) ;

var pna=desk. getItemByLabel(‘pn_pna’);
var pnb=desk. getItemByLabel(‘pn_pnb’);
var pnc=desk. getItemByLabel(‘pn_pnc’);
var pnd=desk. getItemByLabel(‘pn_pnd’);
var pne=desk. getItemByLabel(‘pn_pne’);

var pnai=pna.getId();
var pnbi=pnb.getId();
var pnci=pnc.getId();
var pndi=pnd.getId();
var pnei=pne.getId();

var ap=desk. getItemZIndex(pnai) ;
var bp=desk. getItemZIndex(pnbi) ;
var cp=desk. getItemZIndex(pnci) ;
var dp=desk. getItemZIndex(pndi) ;
var ep=desk. getItemZIndex(pnei) ;

var maxi=ap;
if (bp>maxi) maxi=bp;
if (cp>maxi) maxi=cp;
if (dp>maxi) maxi=dp;
if (ep>maxi) maxi=ep;
maxi=maxi-2; /* the active */

if (ap==maxi) {
void LL. runScript(‘pn_position’, ‘EABCD’ ) ;
return;
}

if (bp==maxi) {
void LL. runScript(‘pn_position’, ‘ABCDE’ ) ;
return;
}

if (cp==maxi) {
void LL. runScript(‘pn_position’, ‘BCDEA’ ) ;
return;
}

if (dp==maxi) {
void LL. runScript(‘pn_position’, ‘CDEAB’ ) ;
return;
}

if (ep==maxi) {
void LL. runScript(‘pn_position’, ‘DEABC’ ) ;
return;
}

_______________________________________________________________________

/* pn_a*/

void LL.runscript(‘pn_position’,’DEABC’);

_______________________________________________________________________

 

/* pn_b*/

void LL.runscript(‘pn_position’,’EABCD’);

 

_______________________________________________________________________

 

/* pn_c*/

void LL.runscript(‘pn_position’,’ABCDE’);

 

_______________________________________________________________________

 

 

 

 

/* pn_d*/

void LL.runscript(‘pn_position’,’BCDEA’);

 

 

_______________________________________________________________________

 

/* pn_e*/

void LL.runscript(‘pn_position’,’CDEAB’);

 

 

 

 

 

Leave a Reply

Your email address will not be published.