Forum Discussion

_rossbower's avatar
_rossbower
Visitor
9 years ago

ScaleRotateCenter problem

I am using an animation to animate a scale change. I want the item to scale up uniformly in all directions. I have the scaleRotateCenter property set to [width / 2, height / 2]. However, when I run my animation, the item grows to the right and downward direction from the top-left corner. Am I misunderstanding the use of scaleRotateCenter?
  • I am seeing this same issue.  Were you able to figure it out?
  • How are you accessing the height/width property of your node?
    Be sure to use boundingRect() to get the proper values. 
  • Here is my code.  

    <component name="TitleGridItem" extends="Group">
    <interface>
    <field id="itemContent" type="node" onChange="showcontent" />
    <field id="focusPercent" type="float" onChange="showfocus" />
    <field id="gridHasFocus" type="boolean" onChange="showfocus"
    alwaysNotify="true" />
    </interface>

    <script type="text/brightscript">
     
        <![CDATA[
     
        function init()
          m.top.id = "markupgriditem"
          m.itemposter = m.top.findNode("itemPoster")
          'm.itemmask = m.top.findNode("itemMask")
          m.itemTitle = m.top.findNode("itemTitle")
        end function
     
        function showcontent()
          itemcontent = m.top.itemContent
          '? itemcontent
          m.itemposter.uri = itemcontent.HDPOSTERURL
        end function
     
        function showfocus()
        if m.top.gridHasFocus
        if (m.top.focusPercent > .8-) then
        m.itemTitle.text = m.top.itemContent.title
        else 
        m.itemTitle.text = ""
        end if
       
    scale = 1 + (m.top.focusPercent * 0.1)
    m.itemposter.scale = [scale, scale]
    'm.itemmask.opacity = 0.75 - (m.top.focusPercent * 0.75)
    end if
        end function
     
        ]]>

    </script>

    <children>
    <LayoutGroup>
    <Poster id="itemPoster"  width="180" translation="[10,10]"
    height="288" scaleRotateCenter="[ 90.0, 144.0 ]" loadDisplayMode="scaleToFit">
    </Poster>
    <Label id="itemTitle" width="190" height="30" horizAlign="center" />
    </LayoutGroup>

    </children>
    </component>
  • Please try inheritParentTransform = "true" in the group tag of xml, which you are scaling.