Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8638229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:40:40+00:00 2026-06-12T10:40:40+00:00

I would like to do the following: Given a container with perspective and an

  • 0

I would like to do the following: Given a container with perspective and an inner element with a translateZ value I’d like to “pull it up” with translateY in order to visually touch the top of the surrounding container: http://jsfiddle.net/8R4ym/129/

Is there some kind of formula that, given the perspective value of a container, the width and height of an element and it’s Z-translation I can get to that kind of “top” calculation? I have been playing around with it but I can’t seem to find some rules for it, as it seems that those are all variables.

Thanks for any help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T10:40:41+00:00Added an answer on June 12, 2026 at 10:40 am

    Yes!

    There’s actually quite a simple formula for finding the offset – the 3d Projection article on Wikipedia has a diagram and the formula.

    The formula is bx = ax * bz / az where:

    • ax is the original distance from the transform origin point
    • az is the perspective + the negative translateZ
    • bz is the perspective

    and this will give you:

    • bx – the new distance from the transform origin point

    So, you need to know:

    • bz : the perspective (eg: 1000px)
    • ax : the offset from the transform origin point, eg: if the origin point is 50% then this needs to be the element’s top relative to the center of the parent element (parent.height/2 + element.top) — let’s say -500px
    • z : the element’s translateZ (eg: -600px)
    • az is then bz + z * -1, in this case: 1000 + (-600 * -1) = 1600

    so the formula is: -500 * 1000 / 1600 = -312.5

    The element is offset vertically -312.5px from the origin, whereas originally it was offset -500px, the difference between the two number is what you’ll need to add to the old top value to get the equivalent new value.

    This formula also works for the Y axis.

    I put together a quick example here: http://jsfiddle.net/trolleymusic/xYRgx/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following: What I would like to happen: 1. Find all Span TAGS
Given the following html table, I would like to control the width of the
Given the following XML, I would like to return all eventtitles where the eventtype
Given the following directory: string fullpath = C:\MyDir1\MyDir2\MyDir3; I would like to return MyDir3
Given a postscript file that has the following header %!PS-Adobe-3.0 I would like to
I would like your help in the following : given the .xml file :
Given a string like the following in JavaScript var a = 'hello world\n\nbye world\n\nfoo\nbar\n\nfoo\nbaz\n\n';
I have a route like following, ideally I would like it to match: domain.com/layout/1-slug-is-the-name-of-the-page
I would like to do something like the following with spark. <viewdata model=IList[[string]] />
I would like to use something like the following: SELECT city FROM cities WHERE

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.