A light point that moves horizontally every second

Hi, I would like to make this: a light point that moves horizontally every second. When it reaches 60 it starts again from a defined X value… I tried several ideas that I found in the forum and the solution I found is this:
“new shape layer” with X= (150-cos(#Dsm#/20)100) and Opacity= (10+90round(#Dsm#%1))
Any other ideas?

1 Like

First things first:
If you are sharing code use the back tickmarks as quotes, others wise the formula does not show all operations: `

Couple of points:

  1. Do not use #Dsm#, it has a glitch when it runs from 59 to 0. Use the equivalent: #DWFSS#/6

  2. If you want to start something every second, then you need a timer that starts at 0. This can be achieved with: (((#DWFSS#/6)%60)-#Ds#)

  3. You can then use that to move the element from one position to the end position using clamp

  4. How to repeat every second? Well #Ds# is true every second, so your formula can be:
    $#Ds#=#Ds#?(clamp(((((#DWFSS#/6)%60)-#Ds#)*250),20,140)):20$

With clamp, the element runs from position 20 to 140. The *250 is the speed and at the end the :20 is where the element is when it is not moving.

NOTE: The timer runs between 0 and 1, so you only have 1 second time to move the object. But that was the idea…

3 Likes

@marcomhtc . If it was something simple you wanted this might do .
This ticks by the second .

(40+(((#Ds#)/60)*240))

As you know #Ds# is 0 to 60 by seconds over the minute . Dividing it by the moves maximum gives 0 to 1 . This is one way to deal with variables . So multiply that by the Max ( 240 ) of your move . Then at the beginning add ( or subtract ) the offset where you want it to start ( 40 ) .

If you want it smooth you will have to use Toms ((#DWFSS#)/360) instead of ((#Ds#)/60) .

Ge back if you get stuck .

3 Likes

Thanks guys!
I started applying the corrections suggested by Tom, now I’ll try your suggestion too

2 Likes

Keep these formulas in a Text Doc . Then promptly forget where you stored that . You can always post an inspectable draft of your Draft . I helps us to have exactly the Idea you are trying to achieve .

1 Like

Yes of course, I have a document where I keep all the formulas that I use during the creation of my faces and that I find here in the forum :slight_smile:
As soon as I finish it I’ll put it here with the inspector active.
Thanks again

2 Likes

Ha Ha . I see you have been around for a while . It is easy to assume someone asking for help is new to it all . We know what assumption gave us . Very Nice work BTW .

2 Likes

Here’s what I needed the formula for:

it’s still not optimal, because the seconds from 0 to 3 remain almost still…

Honestly the things I do are not very beautiful, but they are useful to me because I am farsighted, so I do them with the aim of making the time, date and battery visible mainly :slight_smile:

3 Likes

OK So you have done very well but the formulas are a bit cumbersome . I come from the School of Copy and Paste . I went to University of Trial and Error . However I have Learnt a few things along the way . I have learnt that KISS can Mean Keep it Simple Stupid or Keep it Sophisticated Smartass.
When I am trying to find the Angles and Distance things travelled in Creator . I put #DWFHS# in for the Rotation or the Position . Use the time machine slider to move it to Start then Stop and check the numbers above the Tags Field . In your case I saw that you dot began at 60 and ended at 260 . Nice numbers .

You see I have taken #DWFSS# and divided it by 360 , its MAX . That gives me 0 to 1 and multiply that by the distance of travel ( 200 ) then add the start offset ( 60 ) .

(60+(((#DWFSS#)/360)*200))

I give you a nice flash fade for the opacity that was probably made by Peter . For now just play with the number that is 120 at the moment . 60 gives a seconds pulse . 120 half second , 30 two second .
.

(50+((sin(rad((#DWFSS#)*120)))*50))
.
.

3 Likes

Thank you very much, I really appreciate your suggestions!!

2 Likes