Skip to content

Instantly share code, notes, and snippets.

View vojto's full-sized avatar
🎯
Focusing

Vojtech Rinik vojto

🎯
Focusing
View GitHub Profile
alias gs="git status"
alias gst="git status"
alias ga='git add'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gb='git branch'
alias gba='git branch -a'
alias gco='git checkout'
alias gcm='git checkout master'
alias gp='git push'
import { Text } from 'pixi.js';
import { PixiComponent } from '@inlet/react-pixi';
const FastText = PixiComponent('FastText', {
create: props => new Text(props.text),
applyProps: (instance, oldProps, props) => {
const { x, y, text } = props;
if (x !== oldProps.x || y !== oldProps.y) {
instance.x = x;
applyProps: (instance, oldProps, props) => {
const { x, y, text } = props;
instance.x = x;
instance.y = y;
instance.text = text;
}
applyProps: (instance, oldProps, props) => {
const { x, y, width, height, fill, alpha } = props;
instance.clear();
instance.beginFill(fill);
instance.drawRect(x, y, width, height);
instance.endFill();
instance.alpha = alpha;
}
import { Graphics } from 'pixi.js';
import { PixiComponent, Stage } from '@inlet/react-pixi';
const Rectangle = PixiComponent('Rectangle', {
create: props => new Graphics(),
applyProps: (instance, oldProps, props) => {
const { x, y, width, height, fill, alpha } = props;
if (x !== oldProps.x || y !== oldProps.y || width !== oldProps.width || height !== oldProps.height || fill !== oldProps.fill) {
instance.clear();
instance.alpha = alpha;
instance.clear();
instance.beginFill(fill);
instance.drawRect(x, y, width, height);
instance.endFill();
instance.alpha = alpha;
import { Graphics } from 'pixi.js';
import { PixiComponent, Stage } from '@inlet/react-pixi';
const Rectangle = PixiComponent('Rectangle', {
create: props => new Graphics(),
applyProps: (instance, _, props) => {
const { x, y, width, height, fill, alpha } = props;
instance.clear();
instance.beginFill(fill);
import React from "react";
import {Circle} from "./Primitives";
import {Container} from "@inlet/react-pixi";
export const NodeView: React.FC<{node: Node}> = (props) => {
return (
<Container x={props.node.x} y={props.node.y}>
<Circle x={0} y={0} radius={20} color={0x0000ff} />
</Container>
);
import React from "react";
import {Stage} from "@inlet/react-pixi";
export const Graph: React.FC<{
nodes: Node[];
edges: Edge[];
}> = (props) => {
return (
<Stage>
{props.edges.map((edge) => {