Skip to content

creating new morph

Pawel Przezwanski edited this page Jan 28, 2020 · 2 revisions

To create new morph please use morphFactory. The best way to learn how it work is to study already created morphs. MorphFactory accepts two arguments:

  1. morph unique name
  2. morph config

Morph config options:

property

  • type: string
  • default: 'transform'
  • specifies which css property will be modified and transitioned by this morph.

propertyValue

  • type: function
  • default: undefined
  • specifies how morph's property will be changed. Its input object can be destructured like this: { morphName, options, config, picture, gallery }

If propertyValue returns a string it will be treated as common value for all molecules. If propertyValue returns a function it has to have single argument - molecule object. This function will be iterated with all molecules and calculated css. During this iteration we can read data from molecule objects.

additionalCss

  • type: function
  • default value: undefined
  • a function that returns cssText that is not main property

defaultConfig

  • type: object
  • default: null,
  • specifies this morph specific options default values