Please provide links to the scripts you're talking about and the page in question so that we can see how all of this works together. It's hard to imagine an answer to your question without understanding some context.
Generally speaking, yes-- this sort of thing, using math to manipulate how images are displayed, is possible. But exactly how will depend on the details of your script. Or, you could explain in more general terms what you want to accomplish and we might be able to suggest a suitable script.
Are you talking about this or a related script?
If this is a request for help with a DD script, it should be posted in the "DD scripts help" section. A moderator can move it there for you if you confirm that this is the case. Note that the required format in that section includes the name of the script and a link to the script's page. This makes it easier (and faster) to help you.
If this is a question that can be answered with only the information on the demo page, we can work from that. If this is based on your particular website/installation of the page (and, for example, there is no problem on the demo page) then we will need to see your webpage as well.