https://github.com/nuxy/vue-baraja-js
:file_folder: The / baraja-js / plugin Vue 3 component wrapper.
https://github.com/nuxy/vue-baraja-js
animations cards-game carousel components shuffling vuejs wrapper-library
Last synced: 7 months ago
JSON representation
:file_folder: The / baraja-js / plugin Vue 3 component wrapper.
- Host: GitHub
- URL: https://github.com/nuxy/vue-baraja-js
- Owner: nuxy
- License: other
- Created: 2021-04-17T05:45:56.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-03T18:21:59.000Z (almost 2 years ago)
- Last Synced: 2025-03-22T20:42:11.395Z (over 1 year ago)
- Topics: animations, cards-game, carousel, components, shuffling, vuejs, wrapper-library
- Language: JavaScript
- Homepage: http://baraja-js.nuxy.dev
- Size: 1.73 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Vue Baraja-JS
[](https://badge.fury.io/js/vue-baraja-js) [](https://www.npmjs.com/package/vue-baraja-js) [](https://packagephobia.com/result?p=vue-baraja-js) [](https://github.com/nuxy/vue-baraja-js/releases)

_Baraja_ is a JavaScript plugin that allows to move elements in a card-like fashion and spreads them like one would spread a deck of cards on a table. It uses CSS transforms for rotating and translating the items.
There are several options available that will create various spreading possibilities of the items, for example, moving the items laterally or rotating them in a fan-like way.
Checkout the [demo](https://nuxy.github.io/baraja-js) for examples of use.
## Dependencies
- [Node.js](https://nodejs.org)
## Installation
Add to an existing [Vue](https://vuejs.org) project using [YARN](https://yarnpkg.com).
$ yarn add vue-baraja-js
## Usage
```javascript
import * as Vue from 'vue'
import BarajaJS from 'vue-baraja-js'; // or '../dist/vue-baraja-js';
const cards = [
{
imageSrc: 'path/to/image1.png',
title: 'card 1',
details: 'this is card 1'
},
{
imageSrc: 'path/to/image2.png',
title: 'card 2',
details: 'this is card 2'
},
{
imageSrc: 'path/to/image3.png',
title: 'card 3',
details: 'this is card 3'
},
{
imageSrc: 'path/to/image4.png',
title: 'card 4',
details: 'this is card 4'
},
// add more cards ...
]
const app = Vue.createApp({
data() {
return {
fan: {}
};
},
methods: {
// Fan right
fanEvent() {
this.fan = {
direction: 'right',
easing: 'ease-out',
origin: {
x: 25,
y: 100
},
speed: 500,
range: 90,
center: true
};
}
},
template: `
{{title}}
{{details}}
Fan right
`
});
app.component('baraja-js', BarajaJS).mount('#main');
```
## Component Props
| Name | Type | Description |
|----------|----------|--------------------------|
| id | String | Default `baraja-js` |
| options | Object | Override animation [defaults](https://github.com/nuxy/baraja-js#global-options). |
| add | String | Card item [HTML markup](https://github.com/nuxy/baraja-js#html-markup). |
| fan | Object | Configure [fan options](https://github.com/nuxy/baraja-js#fan-options). |
| close | Boolean | Close the deck if `true` |
| last | Boolean | Show last card if `true` |
| next | Boolean | Show next card if `true` |
## Documentation
- [Methods](https://github.com/nuxy/baraja-js#methods)
- [Fan options](https://github.com/nuxy/baraja-js#fan-options)
## Developers
### CLI options
Run [ESLint](https://eslint.org) on project sources:
$ npm run lint
Transpile ES6 sources (using [Babel](https://babeljs.io)) and minify to a distribution:
$ npm run build
Bundle [demo](https://github.com/nuxy/vue-baraja-js/tree/master/demo) sources (using [Webpack](https://webpack.js.org)):
$ npm run webpack
## Contributions
If you fix a bug, or have a code you want to contribute, please send a pull-request with your changes. (Note: Before committing your code please ensure that you are following the [Node.js style guide](https://github.com/felixge/node-style-guide))
## Versioning
This package is maintained under the [Semantic Versioning](https://semver.org) guidelines.
## License and Warranty
This package is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
_Baraja-JS_ is provided under the terms of the [MIT license](http://www.opensource.org/licenses/mit-license.php)
Demo and proof-of-concept by [Codrops](https://www.codrops.com) [[LICENSE](http://tympanus.net/codrops/licensing)]
Demo background patterns by [Subtle Patterns](https://subtlepatterns.com) [[LICENSE](http://creativecommons.org/licenses/by-sa/3.0/deed.en_US
)]
Demo card illustrations by [Jason Custer](http://dribbble.com/jdelamancha)
## Author
[Marc S. Brooks](https://github.com/nuxy)