Skip to content

Instantly share code, notes, and snippets.

@trusktr
Last active March 7, 2021 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trusktr/7dd84255a1e9a4bbfb1a10098aec8705 to your computer and use it in GitHub Desktop.
Save trusktr/7dd84255a1e9a4bbfb1a10098aec8705 to your computer and use it in GitHub Desktop.

AutolayoutNode lays out its children in the form specified with the VFL code passed into the vfl attribute. For example:

<!-- L-shape Tetris piece: -->
<lume-autolayout-node
	vfl="
		|-[child1(100)]-[child4(child1)]
		|-[child2(child1)]-[child4]
		|-[child3(child1)]-[child4]
		V:|-[child1(100)]-[child2(child1)]-[child3(child1)]
		V:|-[child4(child1)]
  "
>
	<lume-mesh class="one" ...></lume-mesh>
	<lume-mesh class="two" ...></lume-mesh>
	<lume-mesh class="three" ...></lume-mesh>
	<lume-mesh class="four" ...></lume-mesh>
</lume-autolayout-node>

Children should have the class names that match with the ones in the VFL layout code, otherwise any children without a matching name will not be visible in the layout.

NOTE! Lorem ipsum blah blah, so make sure to lorem ipsum blah blah.

Children should have the class names that match with the ones in the VFL layout code, otherwise any children without a matching name will not be visible in the layout.

Properties

.vfl : string

The VFL code defining the desired layout.

.useClassNames : boolean

Default is true. If set to false, then AutolayoutNode will look for matching attribute names instead of classes. F.e. if it is false the above example meshes would be:

<lume-mesh one ...></lume-mesh>
<lume-mesh two ...></lume-mesh>
...

Methods

.makePotion (size: string, ingredients: Ingredient[]) : MagicPotion

Make a magic potion of the given size using the given list of ingredients. For example:

const potion = makePotion('medium', ['wolf blood', 'vampire hair', 'fairy dust'])

You can use the MagicPotionSize enum to specify the size too. For example:

const potion = makePotion(MagicPotionSize.medium, ['wolf blood', 'vampire hair', 'fairy dust'])

Parameters

size : string

The size of the potion ("small", "medium", or "large")

ingredients : Ingredient[]

A list of ingredients to use. The ingredients must be raw and un-cooked. If any ingredients are cooked, the potion may have random undefined and unexpected behaviors on the consumer of the potion.

const potion = makePotion(MagicPotionSize.medium, ['wolf blood', 'vampire hair', 'fairy dust'])

A list of ingredients to use. The ingredients must be raw and un-cooked. If any ingredients are cooked, the potion may have random undefined and unexpected behaviors on the consumer of the potion.

returns MagicPotion

Note that the returned potion will be glowing if it has bonus abilities (and possibly unexpected bonus abilities if any ingredients are cooked).

.makePotion (size: string, ingredients: Ingredient[]) : MagicPotion

Make a magic potion of the given size using the given list of ingredients. For example:

const potion = makePotion('medium', ['wolf blood', 'vampire hair', 'fairy dust'])

You can use the MagicPotionSize enum to specify the size too. For example:

const potion = makePotion(MagicPotionSize.medium, ['wolf blood', 'vampire hair', 'fairy dust'])

Parameters

size : string

The size of the potion ("small", "medium", or "large")

ingredients : Ingredient[]

A list of ingredients to use. The ingredients must be raw and un-cooked. If any ingredients are cooked, the potion may have random undefined and unexpected behaviors on the consumer of the potion.

const potion = makePotion(MagicPotionSize.medium, ['wolf blood', 'vampire hair', 'fairy dust'])

A list of ingredients to use. The ingredients must be raw and un-cooked. If any ingredients are cooked, the potion may have random undefined and unexpected behaviors on the consumer of the potion.

returns MagicPotion

Note that the returned potion will be glowing if it has bonus abilities (and possibly unexpected bonus abilities if any ingredients are cooked).

function makePotion (size, ingredients): MagicPotion

Make a magic potion of the given size using the given list of ingredients. For example:

const potion = makePotion('medium', ['wolf blood', 'vampire hair', 'fairy dust'])

You can use the MagicPotionSize enum to specify the size too. For example:

const potion = makePotion(MagicPotionSize.medium, ['wolf blood', 'vampire hair', 'fairy dust'])

Parameters

size : string

The size of the potion ("small", "medium", or "large")

ingredients : Ingredient[]

A list of ingredients to use. The ingredients must be raw and un-cooked. If any ingredients are cooked, the potion may have random undefined and unexpected behaviors on the consumer of the potion.

const potion = makePotion(MagicPotionSize.medium, ['wolf blood', 'vampire hair', 'fairy dust'])

A list of ingredients to use. The ingredients must be raw and un-cooked. If any ingredients are cooked, the potion may have random undefined and unexpected behaviors on the consumer of the potion.

returns MagicPotion

Note that the returned potion will be glowing if it has bonus abilities (and possibly unexpected bonus abilities if any ingredients are cooked).

function makePotion (size, ingredients): MagicPotion

Make a magic potion of the given size using the given list of ingredients. For example:

Parameters

size : string

The size of the potion ("small", "medium", or "large")

ingredients : Ingredient[]

A list of ingredients to use. The ingredients must be raw and un-cooked or it may have unknown side-effects.

returns MagicPotion

Note that the returned potion will be glowing if it has bonus abilities (and possibly unexpected bonus abilities if any ingredients are cooked).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment