Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animate target while dragging over #607

Closed
hillarycohen opened this issue Jan 6, 2017 · 5 comments
Closed

Animate target while dragging over #607

hillarycohen opened this issue Jan 6, 2017 · 5 comments
Labels

Comments

@hillarycohen
Copy link

Hi there :)

I'm new to React - and React-DnD itself - and picked this lib to make an app for a school work.

I followed the sortable simple example, and basically copy/pasted/adapted for my needs, and it's working fine. However, I'd like to make some animations when the drag hits the target, like creating a smoother movement. I found a comment here, that illustrate what I'm trying to do:

eee3d763fe-d548-11e5-8759-9d51f382181b

Is there any example outside on how can I make such animations? Most similar I could found was this one, but couldn't make much of it. If there's nothing, could someone guide me on which methods should I work on, to make it happen? Any help very appreciated.

Thanks for such a cool lib!

@onsta
Copy link

onsta commented Aug 9, 2017

I am using react-motion library and my code looks similar to this


    const springSetting2 = { stiffness: 130, damping: 18 };
        const motionStyle = {
          translateX: spring(
            this.width,
            springSetting2
          ),
          translateY: spring(
            this.height
            springSetting2
          )
        };
        return (
          <Motion key={`KEY_${name}`} style={motionStyle}>
            {({ translateX, translateY }) =>
              <div
                style={{
                  position: "absolute",
                  transform: `translate(${translateX}px, ${translateY}px)`
                }}
              >
                <AnimatedComponent  />
              </div>}
          </Motion>

@hql287
Copy link

hql287 commented Aug 23, 2017

Could you please explain what does this stand for in the motionStyle constant? What would this.width and this.height would return?

@hillarycohen
Copy link
Author

I wonder if there's a way to animate it without using external libraries?

@hugetiny
Copy link

hugetiny commented Sep 9, 2018

@hillarycohen 'react-beautiful-dnd' can solve your problem

@stale
Copy link

stale bot commented Jul 6, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 6, 2019
@stale stale bot closed this as completed Jul 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants