Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
_rossbower
Level 7

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?
0 Kudos
4 Replies
nmaves
Level 7

Re: ScaleRotateCenter problem

I am seeing this same issue.  Were you able to figure it out?
0 Kudos
Tyler_Smith
Level 7

Re: ScaleRotateCenter problem

How are you accessing the height/width property of your node?
Be sure to use boundingRect() to get the proper values. 
Tyler Smith
Senior Developer, REDspace
redspace.com
0 Kudos
nmaves
Level 7

Re: ScaleRotateCenter problem

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>
0 Kudos
Bhavya
Level 7

Re: ScaleRotateCenter problem

Please try inheritParentTransform = "true" in the group tag of xml, which you are scaling.
0 Kudos