-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
8,544 additions
and
1,820 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"[glsl]": { | ||
"editor.formatOnSave": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { ILayer } from './IRenderable' | ||
import { v4 } from 'uuid' | ||
import { Filter } from './Filter' | ||
import { assign, deepClone } from '../utils' | ||
|
||
export class TextLayer implements ILayer { | ||
public readonly layerType = 'text' | ||
|
||
public readonly id: string = `textlayer-${v4()}` | ||
public name: string = '' | ||
public visible: boolean = true | ||
public lock: boolean = false | ||
public compositeMode: ILayer['compositeMode'] = 'normal' as const | ||
public opacity: number = 100 | ||
|
||
public width: number = 0 | ||
public height: number = 0 | ||
public x: number = 0 | ||
public y: number = 0 | ||
public filters: Filter[] = [] | ||
|
||
public content: TextLayer.Content[] = [] | ||
public letterSpacing: number = 1 | ||
|
||
public static create({ | ||
content, | ||
letterSpacing, | ||
}: { | ||
content: TextLayer.Content[] | ||
letterSpacing: number | ||
}) { | ||
return assign(new TextLayer(), { | ||
content: content, | ||
letterSpacing: letterSpacing, | ||
}) | ||
} | ||
|
||
public update(proc: (layer: TextLayer) => void) { | ||
proc(this) | ||
} | ||
|
||
public serialize() { | ||
return { | ||
layerType: this.layerType, | ||
id: this.id, | ||
name: this.name, | ||
visible: this.visible, | ||
lock: this.lock, | ||
compositeMode: this.compositeMode, | ||
opacity: this.opacity, | ||
width: this.width, | ||
height: this.height, | ||
x: this.x, | ||
y: this.y, | ||
filters: this.filters.map((f) => f.serialize()), | ||
content: deepClone(this.content), | ||
letterSpacing: this.letterSpacing, | ||
} | ||
} | ||
} | ||
|
||
export namespace TextLayer { | ||
export type Content = { content: string } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
import { FilterLayer } from './FilterLayer' | ||
import { RasterLayer } from './RasterLayer' | ||
import { VectorLayer } from './VectorLayer' | ||
import type { FilterLayer } from './FilterLayer' | ||
import type { RasterLayer } from './RasterLayer' | ||
import type { TextLayer } from './TextLayer' | ||
import type { VectorLayer } from './VectorLayer' | ||
|
||
export { RasterLayer } from './RasterLayer' | ||
export { VectorLayer } from './VectorLayer' | ||
export { FilterLayer } from './FilterLayer' | ||
export { TextLayer } from './TextLayer' | ||
export { GroupLayer as Group } from './GroupLayer' | ||
export { Filter } from './Filter' | ||
export { Document } from './Document' | ||
export { Path } from './Path' | ||
export { VectorObject } from './VectorObject' | ||
export type LayerTypes = RasterLayer | VectorLayer | FilterLayer | ||
export type LayerTypes = RasterLayer | VectorLayer | FilterLayer | TextLayer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,38 @@ | ||
declare module '@yr/catmull-rom-spline' { | ||
declare const _: { | ||
const _: { | ||
points(points: number[][]) | ||
} | ||
|
||
export = _ | ||
} | ||
|
||
declare module 'svg-path-bounds' { | ||
declare function _( | ||
function _( | ||
path: string | ||
): [left: number, top: number, right: number, bottom: number] | ||
export = _ | ||
} | ||
|
||
declare module 'point-at-length' { | ||
declare const _: (path: string) => { | ||
const _: (path: string) => { | ||
length(): number | ||
at(point: number): [x: number, y: number] | ||
} | ||
|
||
export = _ | ||
} | ||
|
||
declare module '*.png' { | ||
const _: string | ||
export default _ | ||
} | ||
|
||
declare module '*.frag' { | ||
const _: string | ||
export default _ | ||
} | ||
|
||
declare module '*.glsl' { | ||
const _: string | ||
export default _ | ||
} |
Oops, something went wrong.