User Tag List

Results 1 to 4 of 4

Thread: Converting screen pixels into percent.

  1. #1
    Clicker Multimedia Fusion 2

    Join Date
    Mar 2007
    Location
    I'm right here!!
    Posts
    305
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Converting screen pixels into percent.

    Hi guys.

    My maths is non existent so I'm hoping one of you boffins might be able to help.

    I have an object that can be dragged around on screen, the very center of the object is the anchor point and I need some way of converting the x and y co ordinates from pixel to percent.

    Let's say, for example, I have a 800 x 600 screen, the very center would be 400 x 300 which would be 50% x 50%. if the object was dragged to 400 x 200 then that would be 50% x 33% (I think).

    Does anyone have a formula that can do this, even if the resolution changed (to say 1024 x 768)? Any help would be appreciated.

  2. #2
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    UrbanMonk's Avatar
    Join Date
    May 2008
    Location
    Southern U.S.A.
    Posts
    847
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Re: Converting screen pixels into percent.

    Take the x position and divide it by the x size of the screen and multiply that by 100

    so if the screen is 800 and the object is at 123 then the formula would be "(123/800)*100"

    But you should do "floor(123*1.0/800*1.0)*100" for a more accurate measurement

    Do the same for the y.

  3. #3
    Clicker Multimedia Fusion 2

    Join Date
    Mar 2007
    Location
    I'm right here!!
    Posts
    305
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Converting screen pixels into percent.

    Thank you very much That is greatly appreciated.

  4. #4
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, Århus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: Converting screen pixels into percent.

    A good way of remembering percentage is that you want the outcome to be 0% or 0.0 when the object is as position 0 (no matter the screen resolution) and 100% or 1.0 when the object is at the same position as the screen size. Think of it in "reverse". If the object is at position 800 and your screen size is 800, how do we get 1.0 out of it? From very basic math you know that any number divided with itself is 1 so that is a good start.

    800 (object position)
    --- = 1.0
    800 (screen size)

    1.0 is the equivalent of 100%.


    If the object were half the way on the screen:

    400 (object position)
    --- = 0.5
    800 (screen size)

    which looks very much like 50% of the way

Similar Threads

  1. Mask pixels
    By kinase in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 9th February 2012, 04:31 PM
  2. percent calculation with counter
    By brett in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 2nd February 2011, 08:43 PM
  3. Opacity/Transparency percent
    By FlinkGigitty in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 23rd August 2010, 06:01 PM
  4. Percent Occurance?
    By KingToast in forum Multimedia Fusion 2 - Technical Support
    Replies: 6
    Last Post: 24th July 2007, 07:33 PM
  5. Reconnaissance de Pixels?
    By Marcrem in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 10th July 2006, 04:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •