All Projects → HearthSim → Sunwell

HearthSim / Sunwell

Licence: mit
Canvas-based high quality Hearthstone card renderer

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Sunwell

Searchstone
🃏 Hearthstone's cards search engine built with algolia instantsearch.
Stars: ✭ 117 (+25.81%)
Mutual labels:  hearthstone, card
hs-art-extractor
A tool to extract Hearthstone card art from the game files
Stars: ✭ 21 (-77.42%)
Mutual labels:  card, hearthstone
Uicard
Generic UI for card games like Hearthstone, Magic Arena and Slay the Spire...
Stars: ✭ 142 (+52.69%)
Mutual labels:  hearthstone, card
Spotify-Cards-API
🚀 Unofficial Spotify PromoCards API
Stars: ✭ 13 (-86.02%)
Mutual labels:  canvas, card
Vue Card Diy
Canvas-based custom card vue app
Stars: ✭ 83 (-10.75%)
Mutual labels:  card, canvas
Hearthstone Deck Tracker
A deck tracker and deck manager for Hearthstone on Windows
Stars: ✭ 4,496 (+4734.41%)
Mutual labels:  hearthstone, card
Animated Stars Android
Draw animated stars on Android view canvas - written in Kotlin
Stars: ✭ 85 (-8.6%)
Mutual labels:  canvas
Shots
🥃 A party drinking game that lets you learn more about your friends: Provider + Hive + swipeable_card
Stars: ✭ 89 (-4.3%)
Mutual labels:  card
Watercolor Canvas
Creating watercolor-style canvas art
Stars: ✭ 84 (-9.68%)
Mutual labels:  canvas
Curvejs
Made curve a dancer in HTML5 canvas - 魔幻线条
Stars: ✭ 1,251 (+1245.16%)
Mutual labels:  canvas
Foda
You are at FODA source code. Play now for free
Stars: ✭ 92 (-1.08%)
Mutual labels:  card
Fun Photo Combine
一个有趣的图片合成工具(生成的图片在QQ缩略图与大图表现不同)
Stars: ✭ 90 (-3.23%)
Mutual labels:  canvas
Card Game Simulator
Create, Share, and Play
Stars: ✭ 87 (-6.45%)
Mutual labels:  card
Sketchpad
Sketchpad is fully customisable collaborative whiteboard plugin written in pure JavaScript.
Stars: ✭ 85 (-8.6%)
Mutual labels:  canvas
React Tint
A React component that applies image processing filters to an image using Processing
Stars: ✭ 89 (-4.3%)
Mutual labels:  canvas
Canvas Special
👽🌟超多经典 canvas 实例,动态离子背景、移动炫彩小球、贪吃蛇、坦克大战、是男人就下100层、心形文字等等等
Stars: ✭ 1,256 (+1250.54%)
Mutual labels:  canvas
Vega
A visualization grammar.
Stars: ✭ 9,554 (+10173.12%)
Mutual labels:  canvas
Lowpoly
Lowpoly image generator
Stars: ✭ 83 (-10.75%)
Mutual labels:  canvas
Nanoleaf Desktop
A modern desktop application for the Nanoleaf Aurora and Canvas
Stars: ✭ 90 (-3.23%)
Mutual labels:  canvas
Compress.js
A simple JavaScript based client-side image compression algorithm
Stars: ✭ 86 (-7.53%)
Mutual labels:  canvas

Sunwell

A high quality Hearthstone card renderer in TypeScript.

  • Use it as a Javascript library in the browser to render to a <canvas> element.
  • Or in NodeJS using node-canvas

Download

The latest, minified version of Sunwell is available here:

https://sunwell.hearthsim.net/branches/master/sunwell.cdn.min.js

Requirements

The following dependencies are required to build Sunwell:

Run yarn install to install the dependencies. Then, run webpack to build the project into dist/sunwell.js.

If you run NODE_ENV=production webpack, it will instead build a minified version into dist/sunwell.min.js.

The assets in the assets/ folder can be copied as-is.

Sunwell currently has no runtime dependencies outside of Webpack.

Fonts

To create faithful renders, the Belwe and Franklin Gothic proprietary fonts are required. Make sure to obtain a license if you wish to distribute cards rendered with them.

Sunwell should work with any fallback font you give it.

Usage

Instanciate a new Sunwell object as such:

const Sunwell = require("Sunwell").Sunwell;
let sunwell = new Sunwell(options);

The options object is defined further down.

To render a card, you can use Sunwell.createCard(card). Sunwell aims to be compatible with HearthstoneJSON. You can pass a card object from the HearthstoneJSON API as-is and get a usable card in return.

var card = sunwell.createCard(card, width, target, callback);

width is the size of the render (height is determined automatically). The target argument should be a Canvas or Image object the render will be applied to.

Internally, Sunwell renders to a Canvas already. If you target an image, the conversion to PNG and compression will result in performance loss with frequent updates. Rendering to a Canvas is more direct, however will likely result in performance degradation with large amounts of cards on screen. Pick your poison.

The optional callback argument is a function called when the rendering finishes.

Sunwell options

The following options can be forwarded to the Sunwell instance:

  • debug (boolean: false): If true, extra output will be logged.
  • titleFont (string: "Belwe"): The font to use for the card's name.
  • bodyFont (string: "Franklin Gothic"): The font to use for the card's body.
  • assetFolder (string: "/assets/"): The path to the assets folder.
  • cacheSkeleton (boolean: false): Whether to cache the card's frame render (slow).
  • drawTimeout (number: 5000): The maximum amount of milliseconds Sunwell will spend rendering any single card before giving up.
  • maxActiveRenders (number: 12): How many concurrent renders Sunwell will perform.
  • preloadedAssets (Array): A list of assets to always preload.

Card properties

The following card properties are supported:

  • name (string): The card's name
  • text (string): The card's body text
  • collectionText (string): The card's body text. Has precedence over text.
  • raceText (string): The card's race as a string. Has precedence over race.
  • cost (number): The card's cost.
  • attack (number): The card's attack value (has no effect for spells).
  • health (number): The card's health value (has no effect for spells).
  • costsHealth (boolean): Set to true to render the card's cost as health.
  • hideStats (boolean): Set to true to hide the attack/health textures and the cost value.
  • silenced (boolean): Set to true to show the card as silenced (card text crossed out).
  • language (string): The language of the card. Only used to determine the race text for enums.

Enums are standard Hearthstone enums. They can be passed as an int (preferred) or as their string variant:

  • type (enum CardType): The card's type (only MINION, SPELL and WEAPON are supported).
  • cardClass (enum CardClass): The card's class. This determines the card frame to use.
  • set (enum CardSet): Determines the body text background watermark.
  • rarity (enum Rarity): Determines the card's rarity gem. Note that COMMON cards from the CORE set will not show a rarity gem, despite not being FREE.
  • multiClassGroup (enum MultiClassGroup): Determines the card's multiclass banner.
  • race (enum Race): The card's race.

Finally, a texture property should be passed as well, for the card art. The texture may be a string, in which case it's treated as a URL, or it may be an Image. If null, an empty grey texture will be created in its place.

NOTE: Some properties only affect certain card types unless explicitly set on the card itself. For example, a spell or weapon will not render a race text even if given one.

Community

Sunwell is a HearthSim project. All development happens on our IRC channel #hearthsim on Freenode.

License

This project is licensed under the MIT license. The full license text is available in the LICENSE file.

The assets directory includes files that are copyright © Blizzard Entertainment.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].