Skip to content

Commit b8845f2

Browse files
committed
feat: update storybook
1 parent 7828c8c commit b8845f2

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

.storybook/head.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a href="https://github.com/chenqingspring/react-lottie" class="github-corner" aria-label="View source on Github">
1+
<a href="https://github.com/SilverFox70/react-lottie-segments" class="github-corner" aria-label="View source on Github">
22
<svg width="80" height="80" viewBox="0 0 250 250"
33
style="fill:#e91e63;color:#fff;position:absolute;top:0;border:0;right:0" aria-hidden="true">
44
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>

src/stories/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ storiesOf('Lottie Animation View', module)
1313
.add('toggle like', () => <ToggleLike />)
1414
.add('transitions & loops', () => <TransitionLoop />)
1515
.add('transitions with options', () => <TransitionWithOptions />)
16-
.add('with segments', () => <LottieControlSegments />)
16+
.add('with playSegments', () => <LottieControlSegments />)
1717
.add('with goToAndStop', () => <LottieGoToAndStop />)
1818
.add('with goToAndPlay', () => <LottieGoToAndPlay />);

src/stories/lottie-control-segments.js

+17-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ export default class LottieControlSegment extends React.Component {
2525
margin: '10px auto',
2626
textAlign: 'center',
2727
};
28-
const { isStopped, isPaused, direction, speed, isDataA, startFrame, endFrame } = this.state;
28+
const { isStopped, isPaused, direction, speed, isDataA, startFrame, endFrame, forceFlag } = this.state;
2929
const defaultOptions = { animationData: (isDataA ? animationDataA : animationDataB) };
30+
const segmentOptions = {
31+
segments: [startFrame, endFrame],
32+
forceFlag: false
33+
}
3034

3135
return (<div>
3236
<Lottie
@@ -36,7 +40,7 @@ export default class LottieControlSegment extends React.Component {
3640
isStopped={isStopped}
3741
isPaused={isPaused}
3842
speed={speed}
39-
segments={[startFrame, endFrame]}
43+
playSegments={segmentOptions}
4044
direction={direction}
4145
/>
4246

@@ -56,6 +60,17 @@ export default class LottieControlSegment extends React.Component {
5660
type="text" value={endFrame}
5761
onChange={e => this.setState({ endFrame: parseInt(e.currentTarget.value, 10) || 0 })}
5862
/>
63+
<label htmlFor="forceFlag">
64+
<input
65+
id="forceFlag"
66+
name="forceFlag"
67+
type="checkbox"
68+
checked={forceFlag}
69+
onChange={e => this.setState({ forceFlag: e.currentTarget.checked })}
70+
71+
/>
72+
forceFlag
73+
</label>
5974
</div>
6075
</div>);
6176
}

0 commit comments

Comments
 (0)