0.0.6 • Published 8 years ago

react-komik v0.0.6

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

React Komik!

ReactJS based comic strip creator using fabric.js canvas rendering. It's like spectacle but for comic. You can edit (positioning, scaling, coloring) the comic after rendering. Reactify anything, reactify comic.

react-komik

jscomic

Usage

NPM modules

Just install it from npm

npm install react-komik

You can use the component by require it and bundle it with webpack or browserify. Don't forget to import React, ReactDOM, and use Babel/JSX transformer with ES2015 (recommended)

	import React from 'react';
	import { render } from 'react-dom';
	import { Strip, Panel, Character, Balloon } from 'react-komik';

	let Comic = (props) => (
		<Strip title="Your title here" column="1">
			<Panel>
				<Character
					image="char.png">
					<Balloon 
						text="Reactify Comic!" />
				</Character>
			</Panel>
		</Strip>
	);

	render(<Comic />, document.getElementById('root'));

UMD Browser

Download or include the komik.js file to your HTML. Don't forget to include React, ReactDOM and JSX transformer/Babel. Please use NPM modules instead for production.

	<script src="http://sonnylazuardi.github.io/react-komik/dist/komik.js"></script>
	<script>
		let { Strip, Panel, Character, Balloon } = Komik;

		class Comic extends React.Component {
			render() {
				return (
					<Strip title="Your title here" column="1">
						<Panel>
							<Character
								image="char.png">
								<Balloon 
									text="Reactify Comic!" />
							</Character>
						</Panel>
					</Strip>
				);
			}
		}

		ReactDOM.render(<Comic />, document.getElementById('root'));
	</script>

Demo

This demo is using UMD browser, hosted on codepen and jsbin.

http://codepen.io/sonnylazuardi/pen/JGKmGE

http://jsbin.com/zaxabi/edit?html,js,output

Components

There are four main components:

Strip

AttributeValue TypeDefaultDescription
titleString"Comic Title"Your comic title
columnInteger2Number of comic's column
paddingInteger0Comic padding
widthInteger500Comic's width
heightInteger500Comic's height
topInteger0Comic's top position
leftInteger0Comic's left position
fillString (Color)'white'Comic's background color
strokeString (Color)'black'Comic's stroke color
strokeWidthInteger0Comic's stroke width
fontFamilyString (Font Name)"Arial"Comic's font family
fontSizeInteger13Comic's font size
upperCaseBoolanfalseComic's text upper case

Panel

AttributeValue TypeDefaultDescription
heightInteger180Panel's height
paddingInteger20Panel's padding
fillString (Color)'white'Panel's background color
strokeInteger'black'Panel's stroke color
strokeWidthInteger3Panel's stroke width
backgroundString (Image URL)nullPanel's background image

Character

AttributeValue TypeDefaultDescription
imageString (Image URL)'char1.png'Character's image
scaleDecimal (0 - 1)1Character's image scale
alignString ('center', 'right', 'left')'center'Character's align position
leftIntegernullCharacter's left position (will overwrite align)
bottomInteger0Character's bottom position
topIntegernullCharacter's top position (will overwrite bottom position)

Balloon

AttributeValue TypeDefaultDescription
textString'Hi Bro!'Balloon's text
imageString (SVG URL)'chat_right.svg'Chat balloon SVG images
leftIntegernullBalloon's left position
bottomInteger (from Character's top)-70Balloon's bottom position
topIntegernullBalloon's top position (will overwrite bottom)
scaleDecimal (0 - 1)0.8Balloon's image scale
alignString ('center', 'left', 'right')'left'Balloon's align from character
paddingInteger12Balloon's text padding
heightInteger150Balloon's height
textAlignString ('center', 'left', 'right')'center'Balloon's text align
fontFamilyString (Font Name)(The same with Strip's fontFamily)Balloon's font family
fontSizeInteger(The same with Strip's fontSize)Balloon's font size

Contributing

Ideas, issues, and PRs are welcomed. You can also directly shoot me an email at sonnylazuardi@gmail.com.

JS Comic

This project is actually an effort to write comic easier for JS Comic. Please follow @jscomicnet or like JS Comic FB page.

License

MIT @sonnylazuardi

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago