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
<script> | |
/* This is a quick test of Pts (https://ptsjs.org) with Svelte (https://svelte.dev) */ | |
import { onMount } from "svelte"; | |
import { CanvasSpace, Rectangle } from "pts"; | |
let container, space, form; | |
onMount(() => { | |
space = new CanvasSpace(container).setup({bgcolor: "#52f"}); | |
form = space.getForm(); | |
space.add( time => { |
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
<script type="text/javascript"> | |
space = new CanvasSpace("#pt").setup( {bgcolor: "#f1f1f1"} ) | |
form = new Form( space ) | |
dot = new Circle( 250, 250 ).setRadius( 50 ) | |
another = new Circle( 100, 100 ).setRadius( 50 ) | |
bot = { | |
animate: function ( time, fs, context ) { |
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
// Previous code omitted... | |
if (hits.length > 0) { | |
form.stroke( "#fff" ).fill("#0C9") | |
form.line( new Line( hits[0] ).to( hits[1] ) ) | |
form.points( hits, 5, true ) | |
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
<script type="text/javascript"> | |
// Previous code omitted ... | |
bot = { | |
animate: function(time, fs, context) { | |
// Previous code omitted ... | |
hits = another.intersectCircle( dot ) | |
if (hits.length > 0) { |
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
<script type="text/javascript"> | |
// Previous code omitted ... | |
bot = { | |
animate: function(time, fs, context) { | |
// Previous code omitted ... | |
}, | |
onMouseAction: function(type, x, y, evt) { | |
if (type == "move") { |
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
<script type="text/javascript"> | |
// Previous code omitted ... | |
bot = { | |
animate: function(time, fs, context) { | |
// Previous code omitted ... | |
}, | |
onMouseAction: function(type, x, y, evt) { | |
// Code to track mouse actions will go here |
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
<script type="text/javascript"> | |
// Previous code omitted ... | |
another = new Circle( 100, 100 ).setRadius( 50 ) | |
bot = { | |
animate: function( time, fs, context ) { | |
// Previous code omitted ... | |
form.fill( false ).stroke( "#fc0", 5 ) |
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
<script type="text/javascript"> | |
// Previous code omitted ... | |
bot = { | |
animate: function( time, fs, context ) { | |
form.fill( "#999" ) | |
form.text( new Point( 20, 20 ), "frame rate is "+(1000/fs) ) | |
form.fill( "#5AF" ).stroke( 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
<script type="text/javascript"> | |
// Our exciting code | |
space = new CanvasSpace("#pt").setup( {bgcolor: "#f1f1f1"} ) | |
form = new Form(space) | |
dot = new Circle( 250, 250 ).setRadius( 50 ) | |
bot = { |
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
<script type="text/javascript"> | |
// Our exciting code | |
space = new CanvasSpace("#pt").setup( {bgcolor: "#f1f1f1"} ) | |
form = new Form(space) | |
</script> |
NewerOlder