Skip to content

Commit 2535323

Browse files
committed
demo
1 parent c1e243f commit 2535323

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

demo/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"dependencies": {
1818
"@react-spring/animated": "^9.4.4",
1919
"@react-spring/core": "^9.4.4",
20-
"solid-js": "^1.3.13"
20+
"solid-js": "^1.3.13",
21+
"solid-spring": "workspace:^0.0.0"
2122
}
2223
}

demo/src/App.tsx

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,34 @@
1-
import {createHost} from '@react-spring/animated'
2-
import type { Component } from "solid-js";
1+
import {
2+
Component,
3+
createEffect,
4+
createMemo,
5+
createSignal,
6+
createComponent,
7+
} from "solid-js";
8+
import { createSpring, animated } from "solid-spring";
9+
// console.log(createSpring({to: {x: 'h'}}));
310

4-
console.log(createHost)
5-
const animated = { h1: "" };
11+
function ChainExample() {
12+
const styles = createSpring({
13+
loop: true,
14+
to: [
15+
{ opacity: 1, color: '#ffaaee' },
16+
{ opacity: 0, color: 'rgb(14,26,19)' },
17+
],
18+
from: { opacity: 0, color: 'red' },
19+
})
20+
console.log(styles()[0])
21+
22+
return <animated.div style={styles()[0]}>I will fade in and out</animated.div>
23+
}
624

725
const App: Component = () => {
8-
// const [flip, set] = useState(false);
9-
// const props = useSpring({
10-
// to: { opacity: 1 },
11-
// from: { opacity: 0 },
12-
// reset: true,
13-
// reverse: flip,
14-
// delay: 200,
15-
// onRest: () => set(!flip),
16-
// });
1726

18-
// return <animated.h1 style={props}>hello</animated.h1>;
19-
return <h1 ref={(ref) => console.log(ref)} style={{ background: "red" }}>here</h1>;
27+
return (
28+
<ChainExample />
29+
);
2030
};
2131

32+
// console.log(createComponent(() => <h1>hello</h1>, {}));
33+
2234
export default App;

0 commit comments

Comments
 (0)