Workshop › Klondike Solitaire › Step 12 of 40
Outlines for empty places
What we are doing
The waste and the foundations are empty, so the table does not show where cards will go. Every pile gets a faint white
outline under its cards.
```js
// An empty place shows as an outline.
ctx.strokeStyle = 'rgba(255, 255, 255, 0.35)'
ctx.lineWidth = 2
ctx.strokeRect(x, key[0] === 't' ? TAB_Y : TOP_Y, CW, CH)
```
What it means
rgba(255, 255, 255, 0.35) is white (red, green and blue all 255) at 35% opacity.
- The outline is drawn before the cards, so a card covers it.
Your turn
In draw, under const x = pileX(key), write the four lines. Press Run.
Skills: Drawing on a canvas
← Fan out the columns Turn over a card →
All steps
- The green table
- Draw one card
- The face of a card
- Red and black
- A deck of 52
- Shuffle
- Piles in one object
- Deal the seven columns
- A place for every pile
- Put the piles on the table
- Fan out the columns
- Outlines for empty places
- Turn over a card
- Space turns a card
- Go through the stock again
- What is under the pointer?
- Hitting a card in a column
- Tap the stock
- Rule 1: building a column
- Rule 2: building a foundation
- Move cards by the rules
- Turn over the uncovered card
- Find where a card goes
- Pick up a card
- Tap to move
- A move counter
- Count the moves
- Where did you grab it?
- Follow the pointer
- Draw the held cards at the pointer
- Drop it where you want
- Drop a king into an empty column
- A clock
- Winning
- You won!
- A new game
- The best time
- Snapshots of the table
- Undo
- Build it yourself: finish by itself