# [Q] zooper widget conditionals and advanced explanation?

13 posts
Thanks Meter: 1

By pbl57lsu, Junior Member on 17th November 2013, 01:57 AM
I have been using zooper for over a month now. the conditional advanced formulas make no sense to me. ive tried looking at the formulas for built in widgets such as the clocks to get a better understanding but the numbers for radius and such make no sense to me what so ever. does anyone have a legend breakdown or anything remotely useful for beginners in the advanced stage of zooper?

20th November 2013, 07:16 AM |#2
Member
Thanks Meter: 2

More
i am out of mind in this ask and coming up to the thread to have any ideas suggesting me best in the issue .. i guess it is going to take some time
28th November 2013, 03:37 AM |#3
Senior Member
Thanks Meter: 44

Donate to Me
More
The only conditional I usually use is when charging my battery. Like right now I have a header for my battery piece that just says "battery" but when it's charging, it says "charging" instead.

So my Conditional formula for that says:

Code:
`\$#BSTATN#=2?Charging:Battery\$`
It's kind of like this: \$IF?THEN:IFNOT\$... so If BSTATN is 2 (charging), then write Charging, if not, write Battery. The original formula for this was an "IF NOT" at first but this is easier for what I want to do.

I haven't gotten into any radius stuff with it though... like I said, this is about the most I do with conditionals... maybe it'll help?
28th November 2013, 05:54 AM |#4
Senior Member
Thanks Meter: 44

Donate to Me
More
So I think I figured out the clock bit... First thing I found was this. I also added their WallAnalog default template to look at its pieces.

If you look at their example, they have [ar], [as], and [r] for each of the hands.

AR is the Arc Radius... think of this as the center point of whatever rectangle you make for the hand. It is not the center of the circle, but the distance from the center of the clock to the center of your hand.
AS is the Arc Sweep... this tells it what the position of the hand should be based on the time (not really the rotation, but it's point in the circle).
R is the Rotation... this rotation is actually the rotation of your hand as an object. That is, if you make a rectangle for a hand, it has to rotate itself along with the time and AS to look right, otherwise it would just be a level, flat rectangle moving around a circle.

Not sure if that makes any sense, but let's see if I can show what it means.

If you want a simple clock with just 2 hands that tell you the time, here's what you could do:

Minutes Hand:
Size: 5w x 100h
AR: 50
AS/R: \$(360/60*#Dm#)\$ (this will basically always be this for the minutes - it converts the minutes to a number of degrees within a full circle - 15 min is 90 degrees, 30 min is 180 degrees, etc.

This minute hand would begin at the center of the clock and extend out 100 pixels from there - because the AR number is equal to half of the hand length.

Hour Hand:
Size: 5w x 60h
AR: 30
AS/R: \$((#Dh#*60+#Dm#)/2)\$ (again, another calculation that will be the same for any hour hand you use, just calculating the # of degrees of a circle for the current hour)

This hand is shorter, but again it extends from the center of the clock outward as the AR is again half of the hand length.

If you want to get a little overlap on the other side of the clock center, you basically make the AR smaller. If you make the minutes hand AR 35 and the hour hand AR 15, you get an overlap on the opposite side of the clock hand of 15 pixels (each AR was reduced by 15).

You can see both examples here. The top is the first one and the bottom is the "overlap" I'm talking about. The hands are the same length in both, but the 15 pixel AR difference shifts the hands inward.

If you want to get crazy, you can add some dots or squares at the end. Again, this is just a matter of getting the rectangle sizes and ARs correct... everything else stays the same. You need to create new rectangles for each of the "dots" at the end of the hands.

If we use the second clock above as the example, maybe we want to put a 5x5 red box at the end of each hand. You need to figure out at what point the hand ends.

So the minute hand is 100 pixels, its center is at an AR of 35, so it extends another 50 pixels past that. So the end of the minute hand is now 85. The hour hand is 60 pixels with an AR of 15. This one goes 30 pixels past the AR for an end point at 45. Now your 5x5 red box needs to be at the end of these. The midpoint of the 5x5 box is at 2.5 pixels. Add this number to the end of the hand distance and you have the AR of the dot. So the minute dot AR is 87.5 and the hour dot is at 47.5. That all make sense?

Plugging in all that with the exact same AS and R values gets you the bottom clock shown here:

Do you follow any of that? I literally just learned this all tonight and it makes sense now. I do have one suggestion though - when you are placing your clock components, Use Center as the Screen Anchor for ALL of the pieces. I seem to get some strange positioning if I try to start from any other anchor point.

14th December 2013, 08:22 AM |#5
OP Junior Member
Thanks Meter: 1

More
Im going to play with this tomorrow. Ive been slammed at work. This does make a great deal more sense. Thank you very much for the explanation. I just cant read code for these things without understanding what the numbers represent.

Sent from my SM-N900P using xda app-developers app
20th December 2013, 06:47 AM |#6
OP Junior Member
Thanks Meter: 1

More
My only question really after is what do the \$ signs "dm" and all stand for? Thank you this has helped alot.

Sent from my GT-N5110 using xda app-developers app
22nd April 2014, 05:58 AM |#7
Senior Member
Gandhidham
Thanks Meter: 66

More
\$ stands for calculation and 'dm' stands for minute and 'dh' stands for hour.
22nd April 2014, 02:59 PM |#8
Senior Member
San Antonio, Texas
Thanks Meter: 817

More
Quote:
Originally Posted by ack154

So I think I figured out the clock bit... First thing I found was this. I also added their WallAnalog default template to look at its pieces.

If you look at their example, they have [ar], [as], and [r] for each of the hands.

AR is the Arc Radius... think of this as the center point of whatever rectangle you make for the hand. It is not the center of the circle, but the distance from the center of the clock to the center of your hand.
AS is the Arc Sweep... this tells it what the position of the hand should be based on the time (not really the rotation, but it's point in the circle).
R is the Rotation... this rotation is actually the rotation of your hand as an object. That is, if you make a rectangle for a hand, it has to rotate itself along with the time and AS to look right, otherwise it would just be a level, flat rectangle moving around a circle.

Not sure if that makes any sense, but let's see if I can show what it means.

If you want a simple clock with just 2 hands that tell you the time, here's what you could do:

Minutes Hand:
Size: 5w x 100h
AR: 50
AS/R: \$(360/60*#Dm#)\$ (this will basically always be this for the minutes - it converts the minutes to a number of degrees within a full circle - 15 min is 90 degrees, 30 min is 180 degrees, etc.

This minute hand would begin at the center of the clock and extend out 100 pixels from there - because the AR number is equal to half of the hand length.

Hour Hand:
Size: 5w x 60h
AR: 30
AS/R: \$((#Dh#*60+#Dm#)/2)\$ (again, another calculation that will be the same for any hour hand you use, just calculating the # of degrees of a circle for the current hour)

This hand is shorter, but again it extends from the center of the clock outward as the AR is again half of the hand length.

If you want to get a little overlap on the other side of the clock center, you basically make the AR smaller. If you make the minutes hand AR 35 and the hour hand AR 15, you get an overlap on the opposite side of the clock hand of 15 pixels (each AR was reduced by 15).

You can see both examples here. The top is the first one and the bottom is the "overlap" I'm talking about. The hands are the same length in both, but the 15 pixel AR difference shifts the hands inward.

If you want to get crazy, you can add some dots or squares at the end. Again, this is just a matter of getting the rectangle sizes and ARs correct... everything else stays the same. You need to create new rectangles for each of the "dots" at the end of the hands.

If we use the second clock above as the example, maybe we want to put a 5x5 red box at the end of each hand. You need to figure out at what point the hand ends.

So the minute hand is 100 pixels, its center is at an AR of 35, so it extends another 50 pixels past that. So the end of the minute hand is now 85. The hour hand is 60 pixels with an AR of 15. This one goes 30 pixels past the AR for an end point at 45. Now your 5x5 red box needs to be at the end of these. The midpoint of the 5x5 box is at 2.5 pixels. Add this number to the end of the hand distance and you have the AR of the dot. So the minute dot AR is 87.5 and the hour dot is at 47.5. That all make sense?

Plugging in all that with the exact same AS and R values gets you the bottom clock shown here:

Do you follow any of that? I literally just learned this all tonight and it makes sense now. I do have one suggestion though - when you are placing your clock components, Use Center as the Screen Anchor for ALL of the pieces. I seem to get some strange positioning if I try to start from any other anchor point.