deck-of-cards 介绍
deck-of-cards是一款非常炫酷的html5扑克牌卡片动画类库。它使用纯js和css3来实现洗牌,发牌等功能。在这个效果的演示中,扑克牌使用SVG来制作,共给出了5种功能的演示效果。
安装
npm install deck-of-cards
例子
<html>
<head>
<title>Cards</title>
<link rel="stylesheet" href="node_modules/deck-of-cards/example/example.css">
</head>
<body>
<script src="node_modules/deck-of-cards/dist/deck.min.js"></script>
<div id="container"></div>
<script>
var $container = document.getElementById('container');
// create Deck
var deck = Deck();
// add to DOM
deck.mount($container);
deck.cards.forEach(function (card,i) {
card.setSide(Math.random() < 0.5 ? 'front' : 'back');
// explode
card.animateto({
delay: 1000 + i * 2,// wait 1 second + i * 2 ms
duration: 500,
ease: 'quartOut',
x: Math.random() * window.innerWidth - window.innerWidth / 2,
y: Math.random() * window.innerHeight - window.innerHeight / 2
});
});
</script>
</body>
</html>
GitHub:https://github.com/deck-of-cards/deck-of-cards
网站描述:一款非常炫酷的HTML5扑克牌卡片动画类库
deck-of-cards
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。