forked from mbk-lab/rui_orig
Optimisation
This commit is contained in:
parent
38a8fd2920
commit
9a5fd64758
14
animation.go
14
animation.go
|
@ -493,22 +493,19 @@ func (animation *animationData) writeTransitionString(tag string, buffer *string
|
|||
|
||||
func (animation *animationData) timingFunctionCSS(session Session) string {
|
||||
if timingFunction, ok := stringProperty(animation, TimingFunction, session); ok {
|
||||
if timingFunction, ok = session.resolveConstants(timingFunction); ok && IsTimingFunctionValid(timingFunction, session) {
|
||||
if timingFunction, ok = session.resolveConstants(timingFunction); ok && isTimingFunctionValid(timingFunction) {
|
||||
return timingFunction
|
||||
}
|
||||
}
|
||||
return ("ease")
|
||||
}
|
||||
|
||||
// IsTimingFunctionValid returns "true" if the "timingFunction" argument is the valid timing function.
|
||||
func IsTimingFunctionValid(timingFunction string, session Session) bool {
|
||||
func isTimingFunctionValid(timingFunction string) bool {
|
||||
switch timingFunction {
|
||||
case "", EaseTiming, EaseInTiming, EaseOutTiming, EaseInOutTiming, LinearTiming:
|
||||
return true
|
||||
}
|
||||
|
||||
if timingFunc, ok := session.resolveConstants(timingFunction); ok {
|
||||
timingFunction = timingFunc
|
||||
size := len(timingFunction)
|
||||
if size > 0 && timingFunction[size-1] == ')' {
|
||||
if index := strings.IndexRune(timingFunction, '('); index > 0 {
|
||||
|
@ -531,8 +528,15 @@ func IsTimingFunctionValid(timingFunction string, session Session) bool {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// IsTimingFunctionValid returns "true" if the "timingFunction" argument is the valid timing function.
|
||||
func IsTimingFunctionValid(timingFunction string, session Session) bool {
|
||||
if timingFunc, ok := session.resolveConstants(strings.Trim(timingFunction, " \t\n")); ok {
|
||||
return isTimingFunctionValid(timingFunc)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue