Hey all,

I've updated my oUF layout and found here on the forums zorkers post about the holy grail
So I tried to build it into my layout.
And that's the point. I think that I have all essential parts to do it. But I don't know how to write the function to calculate the offset.

Code:
-- create health func
local function CreateHealth(self)
        self.Health = CreateFrame("StatusBar", nil, self)
        self.Health:SetFrameStrata("LOW")
        self.Health:SetFrameLevel(3)
        self.Health:SetPoint("TOPLEFT")
        self.Health:SetPoint("BOTTOMRIGHT")
        self.Health:SetStatusBarTexture(HealthBar_Inverted)
        self.Health:SetBackdrop(blackbackground)
        self.Health:SetReverseFill(true)
        self.Health.frequentUpdates = FreqUpdate
        self.Health.Smooth = true


local scrollFrame = CreateFrame("ScrollFrame", nil, self.Health)
      scrollFrame:SetSize(self.Health:GetSize())
      scrollFrame:SetPoint("TOP")

local scrollChild = CreateFrame("Frame")
      scrollChild:SetSize(self.Health:GetSize())
      scrollFrame:SetScrollChild(scrollChild)

      
--local calculateOffsetFromPercent = function(self.Health,value)
--    if not value or value and value < 0 then value = 0 end
--    if value > 100 then value = 100 end
--    return self.Health-value*self.Health/100
--end

    
--local offset = calculateOffsetFromPercent(self.Health, value)
--     scrollFrame:SetPoint(scrollFrame:GetPoint(),-offset,0)        
--     scrollFrame:SetHorizontalScroll(-offset)                      


local MyModel = CreateFrame("PlayerModel", nil, scrollChild)
      MyModel:SetSize(self.Health:GetSize())
      MyModel:SetPoint("TOP")
      MyModel:ClearFog()
      MyModel:ClearModel()
      MyModel:SetDisplayInfo(17055)
      MyModel:SetPortraitZoom(0)
      MyModel:SetCamDistanceScale(1)
      MyModel:SetPosition(0,0,0)
      MyModel:SetRotation(-0.4)
  
        CreateBorder(self)
end
hope someone can help me here.
and maybe in an easy way so that i can understand it too