I’m trying to implement a simple bar graph.
And the state of the graph is animated, meaning that bar’s “grow up” to their full height.
It seems to me that if I:
- setReferencePoint of my rectangle to BOTTOM (rec.y = my yAxis)
- create a transition that
a. keeps the Y value the SAME
b. increases the height over time
Then the bar should just “grow up” to it’s ending height.
But it’s not working that way.
Instead, the bars are drifting down as they grow up…more slowly down than up, but still
Code is below and all suggestions appreciated.
– grow bar to it’s ending height
local rect = display.newRect(60, 300, 20, 10)
rect:setFillColor(100,220,220, 255)
rect.endHeight = 150
rect:setReferencePoint(display.BottomLeftReferencePoint)
curY = rect.y – or tried yOrigin
transition.to(rect, {time=2000, height = rect.endHeight, y = curY} ) [import]uid: 6175 topic_id: 1681 reply_id: 301681[/import]