You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This project has a tutorial here that describes a simple ball animation.
From the code hosted here on github, I modified the example slightly to allow multiple balls to spawn from a tap gesture at the top level. However, the coordinates of the balls are incorrect, and balls are not displaying, despite the shared value appearing to be updated.
Here's the full code, very similar to the tutorial:
When I tap, I can see that the balls shared value is modified, but I don't see any balls spawning.
Additionally, if I place a Ball component like <Ball x={100} y={100} /> instead of the {balls ...} line and tap on it, the coordinates logged to the balls shared value array does not seem close at all (hundreds away) to the coordinates of the Ball component, which I find very odd and unexpected, since I'm using absoluteX and absoluteY.
Why are the ball components not rendering, despite the shared value being modified?
Additionally, I am curious why the coordinate systems do not match across the top level Tap and the lower level Pan.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
This project has a tutorial here that describes a simple ball animation.
From the code hosted here on github, I modified the example slightly to allow multiple balls to spawn from a tap gesture at the top level. However, the coordinates of the balls are incorrect, and balls are not displaying, despite the shared value appearing to be updated.
Here's the full code, very similar to the tutorial:
When I tap, I can see that the
balls
shared value is modified, but I don't see any balls spawning.Additionally, if I place a
Ball
component like<Ball x={100} y={100} />
instead of the{balls ...}
line and tap on it, the coordinates logged to theballs
shared value array does not seem close at all (hundreds away) to the coordinates of theBall
component, which I find very odd and unexpected, since I'm usingabsoluteX
andabsoluteY
.Tap
and the lower levelPan
.Beta Was this translation helpful? Give feedback.
All reactions