With all this material.. Here’s a bit of animation! I’d like to see what you guys might do with it!!
With all this material.. Here’s a bit of animation! I’d like to see what you guys might do with it!!
]]>« Title (Previous Post)
(Next Post) I see in the LL description that it includes functions for missed calls/text messages etc, but for the life of me I… »
< ![CDATA[
var c=LL.getEvent().getContainer();
var cw=c.getWidth();
var ch=c.getHeight();
var cx=c.getPositionX();
var cy=c.getPositionY();
var math={
pnt:function(a,b,c){return a+((b-a)*c);},
pthg:function(a,b){return Math.sqrt((a*a)+(b*b));}
};
var i=c.getOpener();
b=cy%ch/ch;
var hex=[
0xff795548,//brown
0xff259b24,//green
0xffff9800,//orange
0xff00bcd4,//cyan
0xffE51C23,//red
0Xff9C27B0,//purple
0Xff673AB7,//deep purple
0XffE91E63,//indigo
0Xff3F51B5,//pink
0xff009688,//teal
0xff607d8b//greyblue
];
var page=cy<0?0:Math.floor(cy/ch)%hex.length;
var p = new Paint();
p.setColor(hex[(page+1)%hex.length]);
img=LL.createImage(cw,ch);
i.setBoxBackground(img,”n s”);
canvas = img.draw();
var r=math.pthg(cw,ch)/2;
r=math.pnt(0,r,b);
if(cy>=ch){canvas.drawColor(hex[page]);}
canvas.drawCircle(cw/2, math.pnt(ch+r,ch/2,b), r, p);
]]>
< ![CDATA[
Haha! That’s pretty dang cool!
]]>
< ![CDATA[
What’s the setup for this? I see it’s several vertical panels, but what all is involved?
]]>
< ![CDATA[
Fantastic
]]>
< ![CDATA[
Awesome!!!
]]>
< ![CDATA[
Great..
How can i use this?
]]>
< ![CDATA[
Math.floor with two parameters? Can’t find that in any wiki. What does it do?
]]>
< ![CDATA[
No setup thomas greer.. Just set this as the position changed event in on a panel.. Those four vertical items are just that.. Items.
]]>
< ![CDATA[
TrianguloY, good catch! I’m surprised it didn’t throw an error.. I just removed it
]]>
< ![CDATA[
Works great with opaque colors, but not with (semi)transparent colors. Any idea?
]]>
< ![CDATA[
I’m going to have to play with it a bit.. I’m thinking clipPath(), but I’ve never used it before
]]>
< ![CDATA[
Check this
http://developer.android.com/reference/android/graphics/PorterDuff.Mode.html
]]>
< ![CDATA[
That’s way easier than what I was thinking! Thanks TrianguloY
I was planning on drawing the rectangle for the background with the circle cut out.. Then drawing the circle..
]]>
< ![CDATA[
TrianguloY Thanks, that works! Just added that one statement before setColor to get it working:
var p = new Paint();
p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
p.setColor(hex[(page+1)%hex.length]);
]]>