Repository navigation
Replies: 3 comments
const [state] = flow.let("x", 0).on("animate", animate).join();
function animate({state}) {
state.x = Math.abs(Math.sin(Date.now() / 1000)) * 200;
}
const svg = shape.svg({width: 200, height: 50}, [
shape.circle({
cx: $(() => scope.x),
cy: 25,
r: 20,
}),
]); |
0 replies
|
Ref. If the child has node attribute, call the method and mount the returned DOM element: shape.svg([
cm.transition(
{
keyframes: [
{delay: 100, ease: d3.easeLinear, duration: 750, fill: "green"},
{fill: "red", duration: 500},
{fill: "brown", duration: 400},
],
onend: ({target}) => target.remove(),
tween: {
fill: (d) => d3.interpolateRgb(d.fill, "black"),
"style.fill": (d) => d3.interpolateRgb(d.fill, "black"),
text: (d) => d3.interpolate(d.text, "Bye!"),
},
},
[shape.rect()],
),
]); |
0 replies
|
Component: const circle = cm.component((flow) => {
const [state, use] = flow()
.let("x", 0)
.on("loop", () => (state.x = Math.abs(Math.sin(Date.now() / 1000) * 200)))
.join();
return svg.svg({width: 200, height: 50}, [
svg.circle({
cx: use("x"),
cy: 25,
r: 20,
}),
]);
}); |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Some proposals for API design.
All reactions