Tag Expression for Placement By Minute?

Would anyone have an example of a tag expression for moving a text object? I am wondering how to make a text object’s placement change based on the minute value.

As an example, a text might be set at x=122 and y=200. Whenever the minute is between 50 and 59, I want the Y to become 196. How do I craft the expression?


Note there are two values for the element coordinates. the fixed part plus the field for expressions. So if you want to change the position from y=200 to y=196 and keep the number 200 in the fixed part field, then the expression need to count only for the difference. Like ([m]>49?(-4):0) or 0-([m]>49)*4.

Thanks, Peter, that works quite well! Had tried but just couldn’t find a clear example of a basic placement tag. So the ending zero in the expression signifies the ‘else’ condition, which is y’s hard-coded 200 px setting?

Its just play with numbers. Does not matter how you split the values, main thing is, that you are aware of it. The first part of value may also be 0, but it defines where will you see the element in the working preview. You can use then expression like ([m]>49?196:200), but that could be confusing in relation to other elements in the working preview.

Is there a way to express a tag for multiple ranges of minutes?

0 to 10, Y moves -14
11 to 20, Y moves -30
21 to 30 , y moves -44
31 to 40, Y moves +10
41 to 50, Y moves +22
51 to 59, Y moves back to its original value 0.

I guess the conditions can be chained like I tried to show earlier with the 12 steps of rotation for Marcin.
Since this forum gets * as sign for text formatting, I will use x in example instead:
0 is automatic result when none of these conditions is met. At least in preview it works.


Use the </> format for code.

Samsung Developer Program

Is there a way to set absolute Y values to the ranges?

yes there is, just replace the current fixed part of the coordinate value with 0 and add it to the expression.

Sorry that I don’t understand, Peter. How would I set hard values of an image or animation based on minutes?

0 to 10, Y = 0
11 to 20, Y = 60
21 to 30, y = 120
31 to 40, Y = 180
41 to 50, Y = 240
51 to 59, Y = 320

its just play with numbers like this:

I guess tag expression coding is something I don’t follow. When I use the above tags, it advances the image okay, but not at the absolute value, it just advances by the amount specified from its starting point wherever it is. So if an image is originally placed where Y = 180 (in the middle) then the code above moves the image by the listed values, but by moving it based on its original position, not by an absolute position. I can work with this, but ideally I would want to specify the image’s actual XY coordinates at any point in the tag expression.

The coordinates consist of two values. The fixed (original placement) plus the expressions.
Its up to you, how you split these values, whether you put 0 in the first field and whole value in the expression, or 180 and relative value in expression. That is why I call it play with numbers.

How do I set an X value by using the day of the year?

Jan 21 (Day 21) I want the X value of an image to be set at 49.
Feb. 5 (Day 36) I want the X value to be 41.
Feb. 18 (Day 49) the X value should become 33.

Any pointers on building a tag expression for multiple case selection?

Tags are basically if - else statements in code.
If true do this - if not do that
Day of the year is kind of unique and confusing
[D] is Month. %of Month with 0 being January and 11 being December
so opacity set for ([D] <= 0.33) ? 100 : 0 would show for 10 days and then not show for the rest of the month.
So this is probably not an easy way do display images.

What you should do is use a digital clock and remap using bitmaps each value so 21 is remapped to 49 and 36 remapped to 41 and so on.

GWS does not allow for global variables if you want to do something like that then you will need to use Tizen Studio and code it in.

Samsung Developer Program

Interesting idea to use bitmap. I would then need to create 365 images, one for each day of the year. Am away from my home PC currently, but my need is to have an imported hour hand set to 24 hours (1 sweep to 24 units) and have an XY position set differently for each day in the year. Your suggestion of using bitmapped images resolves one big design hurdle I was facing, but can an imported bitmapped digital clock act like an hour hand as well? I tried previously to use tag expressions on an image to move the image around like a hour hand but it only moved when the hours changed rather than as a sweep. That is why I liked using the image as an hour hand, as the properties were easier to set.

have you considered having a mask with a hole in it move around to show and hide the values?

So you have one image with all the numbers and then the mask moves to reveal them.

You can move a digital clock in the same pattern as an hour hand but the hour hand image can not contain a digital clock. You’d have to synch the two of them in some manner

Samsung Developer Program

It’s an ambitious project for me. I am trying to design a working astrolabe using GWS. So it’s really an inner circle representing the Zodiac which needs to rotate around once every 24 hours, but also to move and independently rotate within the larger circle in the course of a year. And then to position the Sun and Moon as well as lunar phases. So this inner circle needs to have the X and Y positions change in the course of a year, and also to have the angle change, while keeping the inner pivot at 180 / 180 for the 24 hour rotation.

I can get the inner circle to rotate along with the hour hand, but am needing to set the X and Y positions and angle per day. Using 365 images would resolve all the design issues, but I was hoping to have one image manage for all days.

I have seen Astronomical watch faces but I don’t know if they were done with GWS or Tizen Studio.


Bit of a late reply…but don’t give up :slight_smile:
I would, however make a few suggestions…
(by way of background I’m a new starter to gwd (a few weeks) but am now getting some great sophistication into my faces and having a ball. Samsung have made a great little engine with gwd, great for the beginner to grow with)

  1. You sound like you might be diving in the ‘deep end’ a bit. Take a little by little approach…make a very basic face and add one small feature at a time …practise with them … until you have mastered them. The Samsung tutorial is great …making the ‘spacewatch’ from one of the videos was great fun (my kids still ask to see my attempt :slight_smile: )
  2. Once you’re happy with where you are with the tags and the basics, you do what is called nesting. Eg.
    Can become (for example):
    ([m]>49?(-4): ([m]>39?(-8):0) )
    Where instead of returning 0 in the ‘else’ case it evaluates a new if/then/else
    This gives you very powerful control over tag behaviours (but I wouldn’t try to nest 365 cases!)
  3. Practise, practise, practise
  4. See 3
  5. Hang in there…I’m finding it very rewarding already.
  6. Once you start to get your head around things, the answers to the more complex stuff will come to you.

Good luck!

1 Like