[Q] zooper widget conditionals and advanced explanation?

Search This thread

pbl57lsu

Member
Oct 10, 2013
13
1
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?
 

Claribelsmith

Senior Member
May 27, 2013
74
2
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
 

ack154

Senior Member
Oct 17, 2011
347
96
www.allankintz.com
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?
 

ack154

Senior Member
Oct 17, 2011
347
96
www.allankintz.com
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.

DefLqtM.png


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:

1MgKILM.png


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.

PLEASE do ask questions if you have any questions on this.
 

pbl57lsu

Member
Oct 10, 2013
13
1
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
 

pbl57lsu

Member
Oct 10, 2013
13
1
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
 

scottx .

Senior Member
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.

DefLqtM.png


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:

1MgKILM.png


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.

PLEASE do ask questions if you have any questions on this.

Nice explanation. Thanks for that. I had a few confusion issues on the analogs a month or so ago and used this to help. It helped me create this: https://play.google.com/store/apps/details?id=com.scottech.zwskin.analogpro
 

Top Liked Posts

  • There are no posts matching your filters.
  • 7
    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.

    DefLqtM.png


    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:

    1MgKILM.png


    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.

    PLEASE do ask questions if you have any questions on this.
    4
    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?