-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #208 from zenozeng/svg-element-event-listener
fix: SVGElement event listener
- Loading branch information
Showing
8 changed files
with
41 additions
and
18 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
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 |
---|---|---|
|
@@ -9,10 +9,10 @@ and manipulating existing SVG file without rasterization. | |
Add this line in your projects index.html : | ||
|
||
```html | ||
<script src="https://unpkg.com/[email protected].0"></script> | ||
<script src="https://unpkg.com/[email protected].1"></script> | ||
``` | ||
|
||
(p5.js-svg v1.2.x is compatible with p5.js v1.4.1) | ||
(p5.js-svg v1.3.x is compatible with p5.js v1.4.1) | ||
|
||
Open your sketch.js and edit it: | ||
|
||
|
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 @@ | ||
let value = 0; | ||
|
||
function draw() { | ||
fill(value); | ||
rect(25, 25, 50, 50); | ||
} | ||
|
||
function mouseClicked() { | ||
if (value === 0) { | ||
value = 255; | ||
} else { | ||
value = 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
function setup() { | ||
let canvas = createCanvas(windowWidth, windowHeight, SVG); | ||
canvas.drop(() => { | ||
console.log('ondrop') | ||
}) | ||
} |
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,15 +1,15 @@ | ||
<!doctype html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<script src="https://unpkg.com/p5@1.3.1/lib/p5.js"></script> | ||
<script src="https://unpkg.com/p5.js-svg@1.0.7"></script> | ||
<script src="https://unpkg.com/p5@1.4.1/lib/p5.js"></script> | ||
<script src="../dist/p5.svg.js"></script> | ||
<script src="https://unpkg.com/[email protected]/dist/abcjs-basic-min.js"></script> | ||
<script src="lib/rainbow.js"></script> | ||
<link rel="stylesheet" type="text/css" href="lib/rainbow.css"> | ||
<link rel="stylesheet" type="text/css" href="styles.css"> | ||
</head> | ||
<body> | ||
<h1>Examples for p5.SVG 1.0.7</h1> | ||
<h1>Examples for p5.SVG</h1> | ||
<ul> | ||
<li><a href="#basic">Basic 2D Shapes in SVG</a></li> | ||
<li><a href="#filters">Basic P5 Filters in SVG</a></li> | ||
|
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