-
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.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
12 changed files
with
140 additions
and
42 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,9 @@ | ||
# hello_watch | ||
|
||
This example is like hello_party, but uses `partyWatchShared()` to react to data updates. | ||
|
||
This example shows how to connect to a party server, load a shared data object, and read and write to it. It also shows how to share a p5 color. | ||
|
||
- **click** to move the dot | ||
|
||
> Open this example in two browser windows at once! |
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,15 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<head> | ||
<link rel="stylesheet" href="../sketch.css" /> | ||
</head> | ||
</head> | ||
<body> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.0.0/p5.min.js"></script> | ||
|
||
<script src="/dist/p5.party.js"></script> | ||
|
||
<script src="index.js"></script> | ||
</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,40 @@ | ||
let shared; | ||
function preload() { | ||
partyConnect( | ||
"wss://deepstream-server-1.herokuapp.com", | ||
"hello_party", | ||
"main" | ||
); | ||
shared = partyLoadShared("shared"); | ||
partyWatchShared(shared, onDataChange); | ||
} | ||
|
||
function setup() { | ||
createCanvas(400, 400); | ||
noStroke(); | ||
|
||
// set defaults on shared data | ||
shared.x = shared.x || 0; | ||
shared.y = shared.y || 0; | ||
|
||
// don't draw every frame | ||
noLoop(); | ||
} | ||
|
||
function mousePressed(e) { | ||
// write shared dataa | ||
shared.x = mouseX; | ||
shared.y = mouseY; | ||
} | ||
|
||
function draw() { | ||
background("#ffcccc"); | ||
fill("#000066"); | ||
// read shared data | ||
ellipse(shared.x, shared.y, 100, 100); | ||
} | ||
|
||
function onDataChange() { | ||
// draw when the circle moves | ||
draw(); | ||
} |
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