gnosisguild / wand-nft

wand-nft.vercel.app
8 stars 6 forks source link

state.stone passing incorrect values #103

Open cedricwaxwing opened 2 years ago

cedricwaxwing commented 2 years ago

@samepant I've noticed that the arp is not kicking in right until a few recasts or adjustments sometimes now. When I debugged it, it looks like the stone.state is sometimes coming in as a negative number. For instance, I just checked it and it was -67.6. This is in turn returning a -1 index for the scales array and not allowing the arp to play.

jfschwarz commented 2 years ago

This is something that was changed recently with the inertia branch: All angle states (stone, hue, lightness) are now stored as any number between [-Infinity,Infinity]. For mapping it to [0,360) we need to do something like:

const remainder = angle % 360
const normal = remainder < 0 ? 360 + remainder : remainder
samepant commented 2 years ago

Makes sense, i've got half of this started locally, will push up in a bit

samepant commented 2 years ago

fixed in #88