How do I predetermine the period offset of my sine movement?

So i'm working on a project with spikes that move up and down at variable speeds, from the ceiling of a room to the floor of that room. The distance in between the ceiling and the floor is also variable. I need to know how I can set the offset of the period on the sine movement of the spike based on those variables so that no matter what the height of the room or the speed of the spikes is, the spike always starts at it's highest point. As of now I can set the magnitude of the sine to be equal to the height of the room, but that only makes it go halfway down and then travel too far back upwards.