Swipe cards or elements around with VueSwing
VueSwing
VueSwing is a Vue.js wrapper for the Swing interface. The swipe-left/swipe-right for yes/no input. As seen in apps like Jelly and Tinder, and many others.

Example
To start swinging elements around, start by installing the wrapper:
install it using the following command:
yarn add vue-swing
Register:
import Vue from 'vue'
import VueSwing from 'vue-swing'
Vue.component('vue-swing', VueSwing)
Example usage in your template
<vue-swing
@throwout="throwout"
@throwin="throwin"
:config="config"
>
<div class="box">Toss me! Don't tell the elf!</div>
</vue-swing>
Use the above options to handle your data:
<script>
export default {
name: 'HelloWorld',
data () {
return {
config: {
minThrowOutDistance: 100,
// Determine the rotation of the element
maxRotation: 80
}
}
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.box {
border: 2px solid;
border-radius: 25px;
color: purple;
width: 120px;
}
</style>
Props
VueSwing takes in one config Object, which can consist of any of these keys:
isThrowOutDetermines if element is being thrown out of the stack.allowedDirectionsArray of directions in which cards can be thrown out.throwOutConfidenceInvoked in the event ofdragmove. Returns a value between 0 and 1 indicating the completeness of the throw out condition.throwOutDistanceInvoked when card is added to the stack. The card is thrown to this offset from the stack.minThrowOutDistanceIn effect whenthrowOutDistanceis not overwritten.maxThrowOutDistanceIn effect whenthrowOutDistanceis not overwritten.rotationInvoked in the event ofdragmove. Determine the rotation of the element. Rotation is equal to the proportion of horizontal and vertical offset times themaximumRotationconstant.maxRotationIn effect whenrotationis not overwritten.transformInvoked in the event ofdragmoveand every time the physics solver is triggered. Uses CSS transform to translate element position and rotation.
For more information, look at Swing's documentation
This is it! This project's repository is hosted on GitHub for everyone to see.

