-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
nico
committed
Aug 15, 2023
1 parent
b32039e
commit 8df7dff
Showing
12 changed files
with
85 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,65 @@ | ||
window.isGSAP = true; | ||
|
||
class Effect { // unify Effect & TweenMax calls | ||
|
||
//target, frames, props, ease, delay, override, callback | ||
|
||
constructor(target, frames, props, ease, delay, override, callback) { | ||
ease = ease || "no"; | ||
delay = delay * toSec || 0; | ||
|
||
this.target = target; | ||
this.secs = frames * toSec; | ||
this.callback = callback || function() {}; | ||
this.params = Object.assign(props, {delay: delay, ease: Effect.ease(ease)}); | ||
this.params = Object.assign(props, {duration: frames * toSec, delay: (delay || 0) * toSec, ease: ease()}); | ||
|
||
} | ||
|
||
play() { | ||
return Effect.asyncTween(this.target, this.secs, this.params, this.callback); | ||
|
||
return Effect.asyncTween(this.target, this.params, this.callback); | ||
|
||
} | ||
|
||
static no() { | ||
|
||
return Linear.easeNone; | ||
|
||
} | ||
|
||
static ease(name) { | ||
let eases = { | ||
"no": Linear.easeNone, | ||
"quartIn": Quart.easeIn, | ||
"quartOut": Quart.easeOut, | ||
"quartInOut": Quart.easeInOut, | ||
"bounceOut": Bounce.easeOut | ||
}; | ||
return eases[name]; | ||
static quartOut() { | ||
|
||
return Quart.easeOut; | ||
|
||
} | ||
|
||
static asyncTween(target, duration, options, callback) { // savage TweenMax onComplete promise | ||
return new Promise(resolve => TweenMax.to(target, duration, Object.assign(options, {"onComplete": function() { | ||
callback(); | ||
resolve(); | ||
}}))); | ||
static quartIn() { | ||
|
||
return Quart.easeIn; | ||
|
||
} | ||
|
||
/*static asyncTween(target, duration, options) { | ||
return new Promise(resolve => TweenMax.to(target, duration, Object.assign(options, {"onComplete": resolve}))); // savage TweenMax onComplete promise | ||
}*/ | ||
static quartInOut() { | ||
|
||
return Quart.easeInOut; | ||
|
||
} | ||
|
||
static bounceOut() { | ||
|
||
return Bounce.easeOut; | ||
|
||
} | ||
|
||
static asyncTween(target, options, callback) { | ||
|
||
return gsap | ||
.to( | ||
target, | ||
options | ||
) | ||
.then( | ||
() => | ||
callback() | ||
); | ||
|
||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.