Patrick Rathje
commited on
Commit
·
a925503
1
Parent(s):
37a6803
add logo instead of blur
Browse files- app.py +3 -3
- examples/logo.tsx +131 -0
app.py
CHANGED
|
@@ -107,9 +107,9 @@ EXAMPLES = [
|
|
| 107 |
"project_path": build_example("gradio-motion-canvas-example")
|
| 108 |
},
|
| 109 |
{
|
| 110 |
-
"name": "
|
| 111 |
-
"code": load_example_code("
|
| 112 |
-
"project_path": build_example("
|
| 113 |
},
|
| 114 |
{
|
| 115 |
"name": "Latex",
|
|
|
|
| 107 |
"project_path": build_example("gradio-motion-canvas-example")
|
| 108 |
},
|
| 109 |
{
|
| 110 |
+
"name": "Logo",
|
| 111 |
+
"code": load_example_code("logo"),
|
| 112 |
+
"project_path": build_example("logo")
|
| 113 |
},
|
| 114 |
{
|
| 115 |
"name": "Latex",
|
examples/logo.tsx
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import {makeScene2D} from '@motion-canvas/2d';
|
| 2 |
+
import {
|
| 3 |
+
Node,
|
| 4 |
+
Rect,
|
| 5 |
+
Layout,
|
| 6 |
+
LayoutProps,
|
| 7 |
+
} from '@motion-canvas/2d/lib/components';
|
| 8 |
+
import {all, loop} from '@motion-canvas/core/lib/flow';
|
| 9 |
+
import {createRef, range} from '@motion-canvas/core/lib/utils';
|
| 10 |
+
import {linear} from '@motion-canvas/core/lib/tweening';
|
| 11 |
+
|
| 12 |
+
const YELLOW = '#FFC66D';
|
| 13 |
+
const RED = '#FF6470';
|
| 14 |
+
const GREEN = '#99C47A';
|
| 15 |
+
const BLUE = '#68ABDF';
|
| 16 |
+
|
| 17 |
+
const Trail = (props: LayoutProps) => (
|
| 18 |
+
<Layout layout direction={'column'} gap={30} offsetY={-1} {...props} />
|
| 19 |
+
);
|
| 20 |
+
|
| 21 |
+
export default makeScene2D(function* (view) {
|
| 22 |
+
view.fill('black');
|
| 23 |
+
const star = createRef<Node>();
|
| 24 |
+
const trail1 = createRef<Layout>();
|
| 25 |
+
const trail2 = createRef<Layout>();
|
| 26 |
+
const trail3 = createRef<Layout>();
|
| 27 |
+
const dot = createRef<Rect>();
|
| 28 |
+
|
| 29 |
+
view.add(
|
| 30 |
+
<>
|
| 31 |
+
<Node rotation={-45} position={44} scale={0.8} cache>
|
| 32 |
+
<Node cache y={-270}>
|
| 33 |
+
<Trail ref={trail1}>
|
| 34 |
+
{range(3).map(_ => (
|
| 35 |
+
<Rect width={40} radius={20} height={120} fill={YELLOW} />
|
| 36 |
+
))}
|
| 37 |
+
</Trail>
|
| 38 |
+
<Rect
|
| 39 |
+
width={40}
|
| 40 |
+
radius={20}
|
| 41 |
+
height={270}
|
| 42 |
+
fill={'white'}
|
| 43 |
+
offsetY={-1}
|
| 44 |
+
compositeOperation={'destination-in'}
|
| 45 |
+
/>
|
| 46 |
+
</Node>
|
| 47 |
+
<Node cache x={-70} y={-200}>
|
| 48 |
+
<Trail ref={trail2}>
|
| 49 |
+
{range(3).map(_ => (
|
| 50 |
+
<Rect width={40} height={120} radius={20} fill={RED} />
|
| 51 |
+
))}
|
| 52 |
+
</Trail>
|
| 53 |
+
<Rect
|
| 54 |
+
width={40}
|
| 55 |
+
radius={20}
|
| 56 |
+
height={180}
|
| 57 |
+
fill={'white'}
|
| 58 |
+
offsetY={-1}
|
| 59 |
+
compositeOperation={'destination-in'}
|
| 60 |
+
/>
|
| 61 |
+
</Node>
|
| 62 |
+
<Node cache x={70} y={-300}>
|
| 63 |
+
<Trail ref={trail3}>
|
| 64 |
+
{range(4).map(i => (
|
| 65 |
+
<Rect
|
| 66 |
+
ref={i === 1 ? dot : undefined}
|
| 67 |
+
width={40}
|
| 68 |
+
radius={20}
|
| 69 |
+
height={100}
|
| 70 |
+
fill={i === 0 ? GREEN : BLUE}
|
| 71 |
+
offsetY={1}
|
| 72 |
+
/>
|
| 73 |
+
))}
|
| 74 |
+
</Trail>
|
| 75 |
+
<Rect
|
| 76 |
+
width={40}
|
| 77 |
+
radius={20}
|
| 78 |
+
height={220}
|
| 79 |
+
fill={'white'}
|
| 80 |
+
offsetY={-1}
|
| 81 |
+
y={60}
|
| 82 |
+
compositeOperation={'destination-in'}
|
| 83 |
+
/>
|
| 84 |
+
</Node>
|
| 85 |
+
<Node ref={star}>
|
| 86 |
+
{range(5).map(i => (
|
| 87 |
+
<Rect
|
| 88 |
+
width={100}
|
| 89 |
+
radius={50}
|
| 90 |
+
height={150}
|
| 91 |
+
fill={'white'}
|
| 92 |
+
offsetY={1}
|
| 93 |
+
rotation={(360 / 5) * i}
|
| 94 |
+
compositeOperation={'destination-out'}
|
| 95 |
+
/>
|
| 96 |
+
))}
|
| 97 |
+
{range(5).map(i => (
|
| 98 |
+
<Rect
|
| 99 |
+
width={40}
|
| 100 |
+
radius={20}
|
| 101 |
+
height={120}
|
| 102 |
+
fill={'white'}
|
| 103 |
+
offsetY={1}
|
| 104 |
+
rotation={(360 / 5) * i}
|
| 105 |
+
/>
|
| 106 |
+
))}
|
| 107 |
+
</Node>
|
| 108 |
+
</Node>
|
| 109 |
+
</>,
|
| 110 |
+
);
|
| 111 |
+
|
| 112 |
+
yield* all(
|
| 113 |
+
star().rotation(360, 4, linear),
|
| 114 |
+
loop(4, function* () {
|
| 115 |
+
yield* trail1().position.y(-150, 1, linear);
|
| 116 |
+
trail1().position.y(0);
|
| 117 |
+
}),
|
| 118 |
+
loop(2, function* () {
|
| 119 |
+
yield* trail2().position.y(-150, 2, linear);
|
| 120 |
+
trail2().position.y(0);
|
| 121 |
+
}),
|
| 122 |
+
loop(2, function* () {
|
| 123 |
+
yield* all(
|
| 124 |
+
trail3().position.y(-130, 2, linear),
|
| 125 |
+
dot().fill(GREEN, 2, linear),
|
| 126 |
+
);
|
| 127 |
+
dot().fill(BLUE);
|
| 128 |
+
trail3().position.y(0);
|
| 129 |
+
}),
|
| 130 |
+
);
|
| 131 |
+
});
|