GithubHelp home page GithubHelp logo

Comments (19)

pakastin avatar pakastin commented on May 7, 2024

Yeah, it's unfortunale hardcoded here:
https://github.com/pakastin/deck-of-cards/blob/7afec8d2585b683445f03aa9a8655283be4b87e5/lib/modules/poker.js#L36-L37

and:

https://github.com/pakastin/deck-of-cards/blob/7afec8d2585b683445f03aa9a8655283be4b87e5/lib/modules/bysuit.js#L36-L37

I'm currently rewriting the project, so this will change in the future.. I hope to get it forward during the weekend.

from deck-of-cards.

kenshinbat avatar kenshinbat commented on May 7, 2024

Will be extremely glad if you can make it work, I have been stuck on fixing it for a month now. Can't wait till its the weekend.

Thanks

from deck-of-cards.

pakastin avatar pakastin commented on May 7, 2024

Basically you could customize those modules:

var SIZE = 1; // change this!

var deck = Deck();

deck.bysuit = deck.queued(function (next) {
  deck.cards.forEach(function (card, i) {
    var i = card.i;
    var rank = card.rank;
    var suit = card.suit;
    var delay = i * 10;

    card.animateTo({
      delay: delay,
      duration: 400,

      x: -Math.round((6.75 - rank) * 8 * SIZE), // affects here
      y: -Math.round((1.5 - suit) * 92 * SIZE), // and here..
      rot: 0,

      onComplete: function () {
        if (i === deck.cards.length - 1) {
          next();
        }
      }
    });
  });
});

from deck-of-cards.

pakastin avatar pakastin commented on May 7, 2024

..and poker:

deck.poker = deck.queued(function (next) {
  deck.cards.slice(-5).reverse().forEach(function (card, i, len) {
    var delay = i * 250;

    card.animateTo({
      delay: delay,
      duration: 250,

      x: Math.round((i - 2.05) * 70 * SIZE), // again here's where the magic happens
      y: Math.round(-110 * SIZE), // and here..
      rot: 0,

      onStart: function () {
        card.$el.style.zIndex = (len - 1) + i;
      },

      onComplete: function () {
        card.setSide('front');
        if (i === 4) {
          next();
        }
      }
    });
  }); 
});

from deck-of-cards.

pakastin avatar pakastin commented on May 7, 2024

Should work, I tried it with example.html.. 😉

from deck-of-cards.

pakastin avatar pakastin commented on May 7, 2024

..and like I said I try to get the next-gen version hopefully done during this weekend ;)

from deck-of-cards.

kenshinbat avatar kenshinbat commented on May 7, 2024

It didn't work when I tried it, when I click the Poker and Bysuit buttons, the cards don't deal.
Am I replacing the whole codes in the modules or inserting them from a specific line?

from deck-of-cards.

pakastin avatar pakastin commented on May 7, 2024

Call deck.shuffle() first couple of times 😉

from deck-of-cards.

pakastin avatar pakastin commented on May 7, 2024

Check out: https://github.com/pakastin/deck-of-cards/blob/master/example/example.js

from deck-of-cards.

pakastin avatar pakastin commented on May 7, 2024

So:

deck
.shuffle()
.shuffle()
.poker();

from deck-of-cards.

kenshinbat avatar kenshinbat commented on May 7, 2024

Hi,
I am not getting a hang of this it all. I have explained what I need in the images attached. Thanks
screen shot 2017-10-13 at 10 37 41 am
screen shot 2017-10-13 at 10 41 05 am
screen shot 2017-10-13 at 10 42 32 am

from deck-of-cards.

pakastin avatar pakastin commented on May 7, 2024

Try set the SIZE so that if cards are too close to each other, raise the value and vice versa. If you need a separate Y-value, just add SIZE_Y etc.. :)

from deck-of-cards.

kenshinbat avatar kenshinbat commented on May 7, 2024

What script file, example.js?

from deck-of-cards.

kenshinbat avatar kenshinbat commented on May 7, 2024

Hi,
any luck with the upgrade? I still can't re-arrange the cards. Can you do a replica in the poker script? Just increase the size of the Cards and space them. Thanks

from deck-of-cards.

pakastin avatar pakastin commented on May 7, 2024

Sorry, I got busy with an urgent client work. I’ll work an example for you after couple of hours..

from deck-of-cards.

pakastin avatar pakastin commented on May 7, 2024

Here's an example: https://jsfiddle.net/o5vkm5qz/

You can change the card size in the CSS and it will position accordingly.. (poker + by suit)

from deck-of-cards.

kenshinbat avatar kenshinbat commented on May 7, 2024

Thanks a bunch bro. Been off the project for a while, works fine on jsfiddle. Will check with my project and get back to you.

from deck-of-cards.

kenshinbat avatar kenshinbat commented on May 7, 2024

Hi friend,
Thanks for the help so far, I am back on the project now and still haven't figured out a way to make the cards display in different positions. Attached is the image showing the display intended. Any help please. Thanks
screen shot 2017-10-13 at 10 42 32 am

from deck-of-cards.

pakastin avatar pakastin commented on May 7, 2024

This will get so much easier in the next version!

from deck-of-cards.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.