You know when "now" is. You know when a cycle started. You should, therefore, be able to tell how far into that cycle you are.
The value that you are looking for starts at 0 when you are at the start of the cycle, and rises to 255, and then drops to 0. If you are less then 1/2 way though the cycle, the value will be:
(timeInCycle/lengthOfHalfCycle) * 255.
If you are more then 1/2 way through the cycle, the value will be:
255 - (((timeInCycle - lengthOfHalfCycle)/lengthOfHalfCycle) * 255)
This assumes you want a linear increase in brightness from start of cycle to midpoint of cycle, and a linear decrease in brightness from midpoint of cycle to end of cycle.
If not, you'll need to compute the value using the sin() function, with the percent through the cycle * 360 degrees (for a whole cycle) as the input value (may need to convert to radians). Using the sin() function, it won't matter which half of the cycle you are in. Multiply the output by 255 to get the PWM value.