I'm trying to animate a chunk of text to simulate scrolling where I have some text with different fonts and colors.
My approach to this was:
1. Create an array to put my Text objects in my view class
2. When loading the text, add my text objects to that array (https://prnt.sc/12qlv31)
var foodName = new WatchUi.Text({ :text => foodFullName, :color => 0xFFFFFF, :font => Gfx.FONT_TINY, :justification => Gfx.TEXT_JUSTIFY_VCENTER+Gfx.TEXT_JUSTIFY_LEFT, :locX => 40, :locY => 75 + j*50 }); mealText.add(foodName); var foodQuantity = new WatchUi.Text({ :text => meals[screenStatus.get("meal")].get("food")[j].get("quantity") + "g", :color => 0x999999, :font => Gfx.FONT_XTINY, :justification => Gfx.TEXT_JUSTIFY_VCENTER+Gfx.TEXT_JUSTIFY_LEFT, :locX => 40, :locY => 90 + j*50 }); mealText.add(foodQuantity);
3. When the screen is tapped, this function is called
function scrollAnimation(){ for(var i = 0; i < mealText.size(); i++){ WatchUi.animate(mealText[i], :locY, WatchUi.ANIM_TYPE_LINEAR, mealText[i].locX, mealText[i].locY + 200, 0.25, method(:fx) ); } }
4. And finally I'm drawing those objects in the onUpdate()
for(var i = 0; i < mealText.size(); i++){ mealText[i].draw(dc); }
What am I doing wrong? The elements are rendered but there is no animations.