-
Notifications
You must be signed in to change notification settings - Fork 37
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
1 parent
c422ae3
commit 9edcf44
Showing
7 changed files
with
60 additions
and
14 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,31 @@ | ||
import { main } from '../../../src/main'; | ||
import { SVGScene } from '@pixi-essentials/svg'; | ||
import { Ticker } from 'pixi.js'; | ||
|
||
const svg = ` | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 356"> | ||
<text x="0" y="250" fill="blue" font-family="Helvetica" font-size="72">Hello, SVG!</text> | ||
</svg> | ||
`.trim(); | ||
|
||
main((app) => | ||
{ | ||
app.render = app.render.bind(app); | ||
|
||
const svgElement = new DOMParser().parseFromString(svg, 'image/svg+xml').documentElement as unknown as SVGSVGElement; | ||
const svgScene = new SVGScene(svgElement); | ||
|
||
svgScene.drawPaints(app.renderer); | ||
|
||
app.stage.addChild(svgScene); | ||
|
||
Ticker.shared.addOnce(app.render); | ||
|
||
Object.assign(window, { | ||
svgElement, | ||
}); | ||
}, { | ||
backgroundColor: 0xffffff, | ||
height: 500, | ||
width: 500, | ||
}); |
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 |
---|---|---|
|
@@ -4,5 +4,10 @@ | |
</head> | ||
<body> | ||
<canvas id="view"></canvas> | ||
<style> | ||
canvas { | ||
border: 1px solid black; | ||
} | ||
</style> | ||
</body> | ||
</html> |
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,14 @@ | ||
<html> | ||
<head> | ||
<script src="../bundles/svg/text/index.js" type="module"></script> | ||
</head> | ||
<body> | ||
<canvas id="view"></canvas> | ||
<div style="color: blue; font: normal normal normal 72px Helvetica;">Hello, HTML!</div> | ||
<style> | ||
canvas { | ||
border: 1px solid black; | ||
} | ||
</style> | ||
</body> | ||
</html> |
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