Skip to content

Animate enter and exit for start/finish tile tooltips#23

Merged
catlynbowles merged 8 commits into
mainfrom
gn-118
Feb 1, 2023
Merged

Animate enter and exit for start/finish tile tooltips#23
catlynbowles merged 8 commits into
mainfrom
gn-118

Conversation

@catlynbowles

@catlynbowles catlynbowles commented Jan 30, 2023

Copy link
Copy Markdown
Contributor

What This Does

  • Adds animation with slight spring when tool tips appear / disappear.

How to Test

  1. Hover over the start and end tiles, and ensure that animations fade slightly in / out with a spring effect. Ensure that animations are visible on larger breakpoints --> feedback on effect welcomed !

Accessibility Checklist

  • Markup uses semantic HTML
  • <img> tags have appropriate alt text
  • Links and buttons have discernable text
  • Form inputs have labels
  • Pages are keyboard accessible & focus states are handled

See the
Playbook accessibility page
for more details.

@vercel

vercel Bot commented Jan 30, 2023

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
supernoodle-prototype ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Feb 1, 2023 at 6:11PM (UTC)

@linear

linear Bot commented Jan 30, 2023

Copy link
Copy Markdown

@gvjacob gvjacob left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Liking it so far! :) I think we can hone in on the bounciness a bit more. It should be springy but snappy too.

Comment on lines 49 to +50
<Tooltip.Content className="z-50" sideOffset={15}>
<Tooltip.Arrow className="h-4 w-4 -translate-y-2 rotate-45 rounded-sm bg-white fill-current" />
<div className="relative aspect-[9/6] rounded bg-white">
<div className="flex h-full flex-col items-center justify-center gap-1 p-5 lg:p-10">
<RedHeartSVG />
<h3 className="text-xl font-bold text-purple-dark lg:text-3xl">
Finish!
</h3>
<p className="font-rounded text-xs text-red lg:text-lg">
See your champ grow.
</p>
<motion.div

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can condense these two into just one div by specifying asChild with Tooltip.Content

https://www.radix-ui.com/docs/primitives/components/tooltip#content

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gvjacob could you rephrase this in another way ? By the two do you mean the Content and motion.div ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! The Tooltip.Content is rendering a div on its own on top of your motion.div. If we can avoid it, we shouldn't use too many nested divs.

My suggestion is to do this:

<Tooltip.Content ... asChild>
    <motion.div>...</motion.div>
</Tooltip.Content>

With that, the output will only be a singular div that has all the animations baked into it.

Comment thread src/components/Tile/FinishTile.tsx Outdated
Comment on lines +51 to +59
initial={{ opacity: 0, translateY: 40 }}
animate={{ opacity: 1, translateY: 0 }}
transition={{
translateY: {
type: "spring",
stiffness: 250,
},
}}
>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's still too bouncy but definitely getting closer. I've configured how the animation works for the level previews here.

We probably want to use the same animation config but curious which one you think could work here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can test it out here! https://supernoodle-prototype-l08czolrq-go-noodle.vercel.app/

cc @RegisBiron, also down to switch to regular cubic bezier if you think that's the way to go!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@catlynbowles @gvjacob The subtle bounce works really well here! It stays consistent with the animation language.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gvjacob I think the level tiles animation looks awesome and I am going to apply the same effect here !

@gvjacob gvjacob added this to the 0.2.0 milestone Feb 1, 2023

@gvjacob gvjacob left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! 🥳

@joshpensky joshpensky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 🍇

Comment thread src/components/Tile/FinishTile.tsx Outdated
return (
<BaseTile tile={tile} coordinates={coordinates} outline>
<Tooltip.Provider>
<Tooltip.Provider delayDuration={400}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking: Wondering if we should make these delayDuration={0} to match the other tooltips in #24

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering the same... should I change it now ? @joshpensky @gvjacob

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants