Couldn’t resist doing a mockup of the spinning menu icon
Posted by: pierrot | on October 31, 2014
Couldn’t resist doing a mockup of the spinning menu icon
]]>Posted in | 10 Comments »
Tags: Ren Shore
« I had seen on a site some guy put up a calendar concept and figured i could replicate it with Zooper,so i did… (Previous Post)
(Next Post) Just kinda messing around with a few things today. »
< ![CDATA[
That’s great! How did you do that?
]]>
< ![CDATA[
Greatly scripted rotation and blending. Looks IMHO better than that morphing-crap.
]]>
< ![CDATA[
Of course it’s a script! 🙁 need to learn this language
]]>
< ![CDATA[
How did you do the dark behind the folder panel?
]]>
< ![CDATA[
Benoît de Chezelles might be the script “dim background”
]]>
< ![CDATA[
That’s also a script.. And it’s actually my own.. I wrote it before transparency worked very well and it’s actually using a gradient from transparent to black and item.setPosition
]]>
< ![CDATA[
//EDIT: fixed a bug with -alpha causing flickering
/* ———- CONFIG ———*/
var panelW=540;
/*
——END CONFIG—–*/var d=LL.getCurrentDesktop();
var w=d.getWidth();
var h=d.getHeight();
var x=d.getPositionX();
//select your items..
menu=LL.getItemById(589825);
var back=LL.getItemById(589831);
//(I dont like if statements for one liners.. This is called a ‘Ternary Operator’ if you need to look it up)
var rot=x<0?-x*180/(panelW):0;
var alp=x<0?-x*255/(panelW):0;
//the menu icon is above the back arrow, so we move it once the panel is completey visible
var menuY=x==-panelW?-100:0;
//this area feels sloppy.. can anyone tell me a better way to keep things from wiggling?
menu.setRotation(0);
back.setRotation(0);
menu.setPosition(0,menuY);
back.setPosition(0,0);
menu.setRotation(rot);
back.setRotation(rot);
//set the alpha for the two icons
menu.getProperties().edit().setInteger(“i.alpha”,255-alp).commit();
back.getProperties().edit().setInteger(“i.alpha”,alp).commit();
]]>
< ![CDATA[
Benoît de Chezelles here is the script for the icons rotation/alpha
]]>
< ![CDATA[
Ren Shore thanks a lot 🙂
]]>
< ![CDATA[
The ternary operator ?: is the best! 😀
For the rotation part, you are only rotating the items, so you don’t need to use the trick (my old trick? ) of reset rotation, set position, set rotation.
Only with the setRotation should work.
The issue is when the menu needs to be moved away. Try this, and check if it still is sloppy, if not maybe the problem is somewhere else.
var hidden=x==-panelW;
back.setRotation(rot);
if(!hidden&&menu.getPositionY()!=0)menu.setPosition(0,0);
menu.setRotation(rot);
if(hidden)menu.setPosition(0,-100);
]]>