StateELement 中的缩放元素
我可以在下面写几行并让它工作:
states: State {
name: "active"; when:myitem.activeFocus;
PropertyChanges { target: myitem; z:1000; scale: 1.2 }
}
transitions: Transition {
NumberAnimation { properties: scale; duration: 1000 }
}
但是在这些行中我无法给出缩放属性的具体来源!
我发现 Scale Element
transform: Scale { origin.x: 25; origin.y: 25; xScale: 3}
如何将其注入到上面的状态属性中,因为我想使用状态的“when”属性,
我希望缩放在该“when”条件下运行。
或者是否有其他方法可以在指定原点的条件下进行缩放?
谢谢你的任何想法。
I can write lines below and got it work:
states: State {
name: "active"; when:myitem.activeFocus;
PropertyChanges { target: myitem; z:1000; scale: 1.2 }
}
transitions: Transition {
NumberAnimation { properties: scale; duration: 1000 }
}
But in these lines i can not give specific origin to scale property!
I found Scale Element
transform: Scale { origin.x: 25; origin.y: 25; xScale: 3}
How can i inject this into state property above, because i want to use "when" property of state,
i want scaling to run on that "when" condition.
Or is there any other way to scale in a condition with specifying origins?
Thanks for any idea.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该为
Scale
元素设置一个id
。然后您可以在“活动”状态下更改其属性。这里是一个最小的工作示例:
没有状态的另一种可能性可能是:
按下鼠标时将
xScale
设置为 3,否则设置为 1(如果您不知道“三元运算”,请查看 此处)。You should set an
id
for theScale
element. Then you can change its properties in the "active" state.Here a minimal working example:
Another possibility without states could be:
xScale
is set to 3 when mouse is pressed, else to 1 (if you don't know the " ternary operation" look here).