Commit pirate JS files
This commit is contained in:
39
js/Animation.js
Normal file
39
js/Animation.js
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
Copyright (c) 2023-forever Douglas Malnati. All rights reserved.
|
||||
|
||||
See the /faq/tos page for details.
|
||||
|
||||
(If this generated header is stamped on a file which is a 3rd party file or under a different license or copyright, then ignore this copyright statement and use that file's terms.)
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
export class Animation
|
||||
{
|
||||
// assumes you're starting at 0 opacity, to get to 1
|
||||
static FadeOpacityUp(dom)
|
||||
{
|
||||
if (dom)
|
||||
{
|
||||
let Step;
|
||||
|
||||
Step = () => {
|
||||
dom.style.opacity = parseFloat(dom.style.opacity) + 0.6;
|
||||
|
||||
if (dom.style.opacity >= 1)
|
||||
{
|
||||
dom.style.opacity = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
window.requestAnimationFrame(() => { Step() });
|
||||
}
|
||||
};
|
||||
|
||||
window.requestAnimationFrame(() => { Step() });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user