Example #1
0
    def easeInOut(t, b, c, d, aa, bb):
        s = 1.70158
        p = 0
        a = c
        if t == 0:
            return b

        t /= d/2
        if t == 2:
            return b + c

        if not p:
            p = d * (.3 * 1.5)

        if a < abs(c):
            a = c
            s = p/4
        else:
            s = p/(2*Math.PI) * Math.asin(c/a)


        if t < 1:
            t -= 1
            return -a/2 *Math.pow(2, 10*t) * Math.sin((t*d - s)*(2*Math.PI) / p) + b

        t -= 1
        return a * Math.pow(2, -10*t) * Math.sin((t*d - s)*(2*Math.PI) / p) * .5 + c + b
Example #2
0
    def easeOut(t, b, c, d, aa, bb):
        s = 1.70158
        p = 0
        a = c
        if t == 0:
            return b

        t /= d
        if t == 1:
            return b + c

        if not p:
            p = d * .3

        if a < abs(c):
            a = c
            s = p/4
        else:
            s = p/(2*Math.PI) * Math.asin(c/a)

        return a * Math.pow(2, -10*t) * Math.sin((t*d-s)*(2*Math.PI) / p) + c + b
Example #3
0
 def create_folder(self, name: str) -> str:
     # layout folders as columns
     xpos = 40 + (Math.round(self.count / 4)) * 100
     ypos = 60 + (((self.count % 3)) * 100)
     s = f"left:{xpos}px;top:{ypos}px;"
     # print(name, xpos, ypos)
     return str(
         div(
             _class="folder", _style=s, **{"_data-path": self.dir + "/" + name}
         ).html(
             div(span("📁"), _style="font-size:70px;", _class="icon"),
             span(name, _style="color: white;"),
         )
     )
Example #4
0
 def easeInOut(t, b, c, d, aa, bb):
     t /= d/2
     if t < 1:
         return -c/2 * (Math.sqrt(1 - t*t) - 1) + b
     t -= 2
     return c/2 * (Math.sqrt(1 - t*t) + 1) + b
Example #5
0
 def easeOut(t, b, c, d, aa, bb):
     t /= d
     t -= 1
     return c * Math.sqrt(1 - t*t) + b
Example #6
0
 def easeIn(t, b, c, d, aa, bb):
     t /= d
     return -c * (Math.sqrt(1 - t*t) - 1) + b
Example #7
0
 def easeInOut(t, b, c, d, aa, bb):
     return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b
Example #8
0
 def easeOut(t, b, c, d, aa, bb):
     return c * Math.sin(t/d * (Math.PI/2)) + b
Example #9
0
 def easeIn(t, b, c, d, aa, bb):
     return -c * Math.cos(t/d * (Math.PI/2)) + c + b
Example #10
0
 def easeInOut(t, b, c, d, aa, bb):
     t /= d/2
     if t < 1:
         return c/2 * Math.pow(2, 10 * (t - 1)) + b
     t -= 1
     return c/2 * (-Math.pow(2, -10 * t) + 2) + b
Example #11
0
 def easeOut(t, b, c, d, aa, bb):
     return c * (-Math.pow(2, -10 * t/d) + 1) + b
Example #12
0
 def easeIn(t, b, c, d, aa, bb):
     return c * Math.pow(2, 10 * (t/d - 1)) + b
Example #13
0
 def roll_dice():
     return Math.round(Math.random() * 6)