Skip to content

Commit

Permalink
Merge pull request #78 from sandeep-vedam/fix/transition-easing
Browse files Browse the repository at this point in the history
Renamed transition function key to easing key
  • Loading branch information
michielvandergeest authored Mar 1, 2024
2 parents ebfb9f6 + 715404b commit 165c20a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/application.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ declare namespace Application {
/**
* Easing function to apply to the transition
*/
function?: string,
easing?: string,
/**
* Delay before the transition starts in milliseconds
*/
Expand Down
19 changes: 18 additions & 1 deletion src/element.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ import colors from './lib/colors/colors.js'
import { Log } from './lib/log.js'
import symbols from './lib/symbols.js'

const deprecationMsg = `
----------------------------------------------------------------------------------------------------
Deprecation notice:
----------------------------------------------------------------------------------------------------
The property for defining a transition easing function has been renamed from "function" to "easing".
Please update your code like the example below to keep your custom easing function.
Before: <Element :y.transition=“{v: $y, function: ‘ease-in-out’}” />
After: <Element :y.transition=“{v: $y, easing: ‘ease-in-out’}” />
`

const isTransition = (value) => {
return typeof value === 'object' && 'transition' in value
}
Expand Down Expand Up @@ -307,7 +322,9 @@ const Element = {
easing:
typeof transition === 'object'
? 'function' in transition
? transition.function
? Log.warn(deprecationMsg)
: 'easing' in transition
? transition.easing
: 'ease'
: 'ease',
delay: typeof transition === 'object' ? ('delay' in transition ? transition.delay : 0) : 0,
Expand Down

0 comments on commit 165c20a

Please sign in to comment.