Skip to content

Instantly share code, notes, and snippets.

@andymeneely
Last active March 16, 2016 03:08
Show Gist options
  • Save andymeneely/5026392a419124312cb7 to your computer and use it in GitHub Desktop.
Save andymeneely/5026392a419124312cb7 to your computer and use it in GitHub Desktop.
Squib Examples: From SSE presentation
*.png
!part*_expected.png
require 'squib'
Squib::Deck.new cards: 1 do
background color: 'pink'
rect
text str: 'Draw two cards.'
save_png prefix: 'part1_', dir: '.'
end
require 'squib'
Squib::Deck.new cards: 1 do
background color: '#252322'
rect fill_color: '#0B3736',
x: 38, y: 38, width: 750, height: 1050, radius: 38
text str: 'Robot Golem', font: 'True Crimes, Sans 72',
align: :center, x: 75, width: :deck, color: '#DFDFE1', y: 90
svg file: 'auto-repair.svg', x: 75, y: 75, width: 100, height: :scale
svg file: 'robot-golem.svg', x: 75, y: 300, width: 675, height: :scale
text str: 'Draw two cards', font: 'Serif 36',
align: :center, width: :deck, color: '#DFDFE1', y: 1000
save_png prefix: 'part2_', dir: '.'
end
require 'squib'
Squib::Deck.new cards: 1, layout: 'part3_layout.yml' do
background color: '#252322'
rect layout: 'backdrop'
text str: 'Robot Golem', layout: 'title'
svg layout: 'drone'
svg file: 'robot-golem.svg', layout: 'art'
text str: 'Draw two cards.', layout: 'power'
save_png prefix: 'part3_', dir: '.'
end
require 'squib'
Squib::Deck.new cards: 2, layout: 'part3_layout.yml' do
background color: '#252322'
rect layout: 'backdrop'
text str: ['Robot Golem', 'Ninja'],
layout: 'title'
svg layout: ['drone', 'human']
svg file: ['robot-golem.svg','ninja-mask.svg'],
layout: 'art'
text str: ['Draw two cards',
'Use the power of another player'],
layout: 'power'
save_png prefix: 'part4_', dir: '.'
end
require 'squib'
Squib::Deck.new cards: 4, layout: 'part3_layout.yml' do
background color: '#252322'
rect layout: 'backdrop'
data = xlsx file: 'data.xlsx'
text str: data['name'], layout: 'title'
svg layout: data['class']
svg file: data['art'], layout: 'art'
text str: data['power'], layout: 'power'
save_png prefix: 'part5_', dir: '.'
hand file: 'part5_hand.png', dir: '.', trim_radius: 38
showcase file: 'part5_showcase.png', dir: '.'
end
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path stroke-width="0" stroke="#fff" fill="#0B3736" d="M0 0h512v512H0z"></path><path fill-rule="evenodd" fill="#DFDFE1" d="M164.594 21.625c-.537.012-1.068.028-1.563.094-29.656 3.852-52.56 35.847-52.56 74.75 0 21.55 7.307 41.193 18.686 54.905-61.678 11.594-66.563 115.158-66.562 188.063h43.218l11.094 152.437h63.063L168.905 340.03h21.47l11.343 152.158h108.686l10.03-152.157h21.627l-9.907 151.845h63.063l10.53-152.438h40.28c0-73.107 1.407-178.78-65.967-189.218 10.89-13.646 18.093-32.734 18.093-53.75 0-41.496-26.52-74.75-59-74.75-2.03 0-4.43-.263-6.406 0-9.4 1.22-17.562 5.455-25.125 11.686 16.388 13.303 27.468 36.433 27.47 63.063 0 21.016-7.236 40.104-18.126 53.75 67.373 10.438 66 116.11 66 189.218h-21.94c.008-73.086 1.29-178.215-65.905-188.625 10.89-13.647 17.906-32.61 17.906-53.625 0-41.497-26.457-75-58.936-75-2.03 0-4.117-.262-6.094 0-29.657 3.85-52.813 36.095-52.813 75 0 21.547 7.373 40.788 18.75 54.5-61.514 11.563-66.318 114.874-66.343 187.75H126.25c-.002-72.905 4.322-176.47 66-188.063-11.38-13.712-18.687-33.356-18.688-54.906 0-26.575 11.138-49.632 27.438-63.064-9.148-7.425-19.896-11.687-31.53-11.687-1.525 0-3.267-.132-4.876-.095z"></path></svg>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
backdrop:
fill_color: '#0B3736'
x: 38
y: 38
radius: 38
width: 750
height: 1050
title:
font: 'True Crimes, Sans 72'
align: center
color: '#DFDFE1'
x: 75
y: 90
width: 825
drone:
file: auto-repair.svg
x: 75
y: 75
width: 100
height: 100
human:
extends: drone
file: humans.svg
art:
x: 75
y: 300
width: 675
height: 675
power:
font: 'Serif 36'
align: center
width: 825
color: '#DFDFE1'
y: 1000
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment